Glide Note

glidenote's blog

Fedora16 systemctlコマンドのメモ

自宅サーバはFedora 16で構築してるんですが、systemctlコマンドが全く頭に入ってこないので自分用にメモ。 2回ググったらブログに書く。

たとえばsquidを管理する場合

起動

1
sudo systemctl start squid.service

停止

1
sudo systemctl stop squid.service

再起動

1
sudo systemctl restart squid.service

自動起動設定

1
sudo systemctl enable squid.service

自動起動の解除

1
sudo systemctl disable squid.service

statusを確認

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[[email protected]] $ sudo systemctl status squid.service
squid.service - Sqid caching proxy
      Loaded: loaded (/lib/systemd/system/squid.service; enabled)
          Active: active (running) since Mon, 06 Feb 2012 00:41:33 +0900; 3min 53s ago
             Process: 3410 ExecStop=/usr/sbin/squid -k shutdown -f $SQUID_CONF (code=exited, status=0/SUCCESS)
                 Process: 3400 ExecReload=/usr/sbin/squid $SQUID_OPTS -k reconfigure -f $SQUID_CONF (code=exited, status=0/SUCCESS)
                     Process: 3418 ExecStart=/usr/sbin/squid $SQUID_OPTS -f $SQUID_CONF (code=exited, status=0/SUCCESS)
                         Process: 3412 ExecStartPre=/usr/libexec/squid/cache_swap.sh (code=exited, status=0/SUCCESS)
                            Main PID: 3419 (squid)
                                  CGroup: name=systemd:/system/squid.service
                                          ├ 3419 /usr/sbin/squid -f /etc/squid/squid.conf
                                                  ├ 3421 (squid-1) -f /etc/squid/squid.conf
                                                          ├ 3426 (logfile-daemon) /var/log/squid/access.log
                                                                  └ 3427 (unlinkd)

その他のコマンド

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
[[email protected]] $ systemctl
systemctl command
cancel                               -- Cancel all, one, or more jobs
daemon-reexec                        -- Reexecute systemd manager
daemon-reload                        -- Reload systemd manager configuration
default                              -- Enter system default mode
delete                               -- Remove one or more snapshots
disable                              -- Disable one or more unit files
dot                                  -- Dump dependency graph for dot(1)
dump                                 -- Dump server status
emergency                            -- Enter system emergency mode
enable                               -- Enable one or more unit files
exit                                 -- Ask for user instance termination
halt                                 -- Shut down and halt the system
is-active                            -- Check whether units are active
is-enabled                           -- Check whether unit files are enabled
isolate                              -- Start one unit and stop all others
kexec                                -- Shut down and reboot the system with kexec
kill                                 -- Send signal to processes of a unit
list-jobs                            -- List jobs
list-units                           -- List units
load                                 -- Load one or more units
monitor                              -- Monitor unit/job changes
poweroff                             -- Shut down and power-off the system
reboot                               -- Shut down and reboot the system
reload                               -- Reload one or more units
reload-or-restart                    -- Reload one or more units is possible, otherwise start or restart
reload-or-try-restart  force-reload  -- Reload one or more units is possible, otherwise restart if active
rescue                               -- Enter system rescue mode
reset-failed                         -- Reset failed state for all, one, or more units
restart                              -- Start or restart one or more units
set-environment                      -- Set one or more environment variables
show                                 -- Show properties of one or more units/jobs or the manager
show-environment                     -- Dump environment
snapshot                             -- Create a snapshot
start                                -- Start (activate) one or more units
status                               -- Show runtime status of one or more units
stop                                 -- Stop (deactivate) one or more units
try-restart            condrestart   -- Restart one or more units if active
unset-environment                    -- Unset one or more environment variables

systemdでは/lib/systemd/systemに設定ファイルを用意して、 /etc/systemd/system配下のxxxx.wantsへリンクを貼ると自動起動設定となる。

ちなみにzshのバージョンを4.3.15にあげたらsytemctlの補完が効いてくれるようになった

Comments