via Control Synology DSM Services via Terminal / SSH
SynologyのNASに対してSSHでログインすることでLinuxとしてコマンド操作することができる。
ただし、自由にコマンドを追加していいわけではなく、DSMのアップデート時などに不整合が起こることが想定され、安定性を考えるとむやみにコマンドを追加するべきではない。
そこで、DSMに標準搭載されているコマンドをここに列挙する。
前提と注意
sudo -i はrootのシェルに入るコマンド。管理者ユーザーがsudoersに入っている必要がある。通らないときは sudo -s を試すか、DSM側のユーザー設定を見直す。systemctl は用意されていない。apt や yum でパッケージを足すのも基本は非推奨で、DSMのアップデート時に消えたり壊れたりする。SSHではDSMのユーザーでログインできるが、管理者権限を得るためには以下のコマンドが必要。
sudo -i
以下のコマンドはDSMのサービスを制御するためのコマンド。
オプションの読み方
synoservice は「runkey(再起動後も有効にするか)」と「今の起動状態」を別々に持っている。--enable はrunkeyをyesにして今も起動、--start は今だけ起動してrunkeyは触らない。--disable はrunkeyをnoにして今も止める。--hard-enable / --hard-disable は依存するサービスもまとめて扱う。強力だが巻き添えが大きい。ネットワーク系をhard-disableすると管理画面に戻れなくなることがあるので、使うのは最後の手段にする。--is-enabled でrunkeyの状態、--status で今動いているかを見る。トラブル時はこの2つを最初に確認する。なんかコマンドが変わったかも。(20201227)
SynoService Tool Help (Version 25426)
Usage: synoservice
--help Show this help
--help-dev More specialty functions for deveplopment
--is-enabled [ServiceName] Check if the service is enabled
--status [ServiceName] Get the status of specified services
--enable [ServiceName] Set runkey to yes and start the service (alias to --start)
--disable [ServiceName] Set runkey to no and stop the service (alias to --stop)
--hard-enable [ServiceName] Set runkey to yes and start the service and its dependency (alias to --hard-start)
--hard-disable [ServiceName] Set runkey to no and stop the service and its dependency (alias to --hard-stop)
--restart [ServiceName] Restart the given service
--reload [ServiceName] Reload the given service
--pause [ServiceName] Pause the given service
--resume [ServiceName] Resume the given service
--pause-by-reason [ServiceName] [Reason] Pause the service by given reason
--resume-by-reason [ServiceName] [Reason] Resume the service by given reason
--pause-all (-p) [Reason] (Event) Pause all service by given reason with optional event(use -p to include packages)
--pause-all-no-action (-p) [Reason] (Event) Set all service runkey to no but leave the current service status(use -p to include packages)
--resume-all (-p) [Reason] Resume all service by given reason(use -p to include packages)
--reload-by-type [type] (buffer) Reload services with specified type
--restart-by-type [type] (buffer) Restart services with specified type
Type may be {file_protocol|application}
Sleep $buffer seconds before exec the command (default is 0)
以前のコマンド
旧コマンドとの対応
synoservicecfg と synoservicectl は古いDSM(6.0あたりまで)のコマンドで、現行DSMでは synoservice に統合されている。古い手順をそのまま打つと command not found になるので読み替える。--status <ServiceName> で確認する。pkgctl-Plex Media Server のようにスペースが入るものはクォートで括る。synoservicecfg –list
synoservice –status
synoservicecfg –stop <service>
synoservicecfg –hard-stop <service>
synoservicecfg –start <service>
synoservicecfg –hard-start <service>
synoservice –restart <service>
synoservicectl –restart <service>
WebStationを再起動する場合:
synoservice --restart pkgctl-WebStation
Dockerの場合:
synoservice --restart pkgctl-Docker
DSM Services & Package Services:
再起動の使いどころ
pkgctl-<パッケージ名> というサービス名で動いている。GUIで「停止」してもプロセスが残ることがあり、そのときにSSHから --restart すると確実に落とせる。--reload で設定の再読み込みを試す。プロセスを止めずに済む。DSM
apparmor
atalk
avahi
bluetoothd
bonjour
btacd
crond
cups-lpd
cupsd
dbus
dc-output
ddns
findhost
ftpd
ftpd-ssl
gcpd
heartbeat
hotplugd
iscsitrg
ldap-server
miniupnpd-handler
natpmpd
nfsd
nginx
nmbd
nslcd
ntpd-client
ntpd-server
pgsql
pkgctl-Apache2.4
pkgctl-AudioStation
pkgctl-CMS
pkgctl-CloudSync
pkgctl-DNSServer
pkgctl-Docker
pkgctl-DownloadStation
pkgctl-FileStation
pkgctl-Git
pkgctl-HyperBackup
pkgctl-Java8
pkgctl-LogCenter
pkgctl-MariaDB
pkgctl-MariaDB10
pkgctl-Node.js_v4
pkgctl-PEAR
pkgctl-PHP5.6
pkgctl-PHP7.0
pkgctl-Plex Media Server
pkgctl-StorageAnalyzer
pkgctl-TextEditor
pkgctl-VPNCenter
pkgctl-WebStation
pkgctl-adminer
pkgctl-domoticz
pkgctl-filebot
pkgctl-filebot-node
pkgctl-git
pkgctl-python
pkgctl-sickrage
pppoerelay
rsyncd
s2s_daemon
samba
scemd
sftp
snmp
ssdp
ssh-shell
support-remote-access
synoagentregisterd
synobackupd
synocacheclient
synocachepinfiletool
synocgid
synoconfd
synocontentextractd
synocrond
synogpoclient
synoindexd
synologrotate
synomkflvd
synomkthumbd
synomount
synoovs-db
synoovs-vswitch
synoperfeventd
synorelayd
synosnmpcd
synostoraged
synotifyd
synotunnel
synovpnclient
synowifid
syslog-acc
syslog-ng
syslog-notify
system
telnetd
tftp
upnpd
ups-net
ups-usb
usbipd
winbindd
synoservice --help で確認。※ 本ページのAmazonリンクにはアフィリエイトタグ(toobf6-22)が付いている。
🤖 このページにはAIエージェント(ノア)による編集・加筆が含まれます。内容の正確性は保証できないため、重要な判断は一次情報でご確認ください。