cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #00581
Re: [Merge] lp:~sergiusens/cloud-init/snappy into lp:~smoser/cloud-init/snappy
> some questions
> a.) why 'status' after 'start' ?
> the output of that command wont go anywhere where you could see it
> b.) will 'start' fail if already started ?
> will 'stop' fail if not started ?
>
> we dont want to raise exception in the event of either of 'b' erroring out if
> the end result is correct.
Given 'a' and 'b' I'll remove status; I thought we wanted to error if it failed to start for whatever reason and status returns '3' if the service is stopped;
wrt 'b' specifically, it's idempotent
ubuntu@localhost:~$ sudo systemctl start ssh
ubuntu@localhost:~$ echo $?
0
ubuntu@localhost:~$ sudo systemctl start ssh
ubuntu@localhost:~$ echo $?
0
ubuntu@localhost:~$ sudo systemctl start ssh
ubuntu@localhost:~$ sudo systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled)
Active: active (running) since Tue 2014-12-02 16:32:39 UTC; 34s ago
Main PID: 759 (sshd)
CGroup: /system.slice/ssh.service
└─759 /usr/sbin/sshd -D
Dec 02 16:32:39 localhost.localdomain systemd[1]: Started OpenBSD Secure Shel...
Dec 02 16:32:39 localhost.localdomain sshd[759]: Could not load host key: /e...y
Dec 02 16:32:39 localhost.localdomain sshd[759]: Server listening on 0.0.0.0....
Dec 02 16:32:39 localhost.localdomain sshd[759]: Server listening on :: port 22.
Dec 02 16:32:44 localhost.localdomain systemd[1]: Started OpenBSD Secure Shel...
Dec 02 16:33:08 localhost.localdomain systemd[1]: Started OpenBSD Secure Shel...
Hint: Some lines were ellipsized, use -l to show in full.
ubuntu@localhost:~$ sudo systemctl stop ssh
ubuntu@localhost:~$ sudo systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled)
Active: inactive (dead) since Tue 2014-12-02 16:33:17 UTC; 2s ago
Process: 759 ExecStart=/usr/sbin/sshd -D $SSHD_OPTS (code=exited, status=0/SUCCESS)
Main PID: 759 (code=exited, status=0/SUCCESS)
Dec 02 16:32:39 localhost.localdomain systemd[1]: Started OpenBSD Secure Shel...
Dec 02 16:32:39 localhost.localdomain sshd[759]: Could not load host key: /e...y
Dec 02 16:32:39 localhost.localdomain sshd[759]: Server listening on 0.0.0.0....
Dec 02 16:32:39 localhost.localdomain sshd[759]: Server listening on :: port 22.
Dec 02 16:32:44 localhost.localdomain systemd[1]: Started OpenBSD Secure Shel...
Dec 02 16:33:08 localhost.localdomain systemd[1]: Started OpenBSD Secure Shel...
Dec 02 16:33:17 localhost.localdomain systemd[1]: Stopping OpenBSD Secure She...
Dec 02 16:33:17 localhost.localdomain systemd[1]: Stopped OpenBSD Secure Shel...
Hint: Some lines were ellipsized, use -l to show in full.
ubuntu@localhost:~$ echo $?
3
ubuntu@localhost:~$ sudo systemctl stop ssh
ubuntu@localhost:~$ echo $?
0
--
https://code.launchpad.net/~sergiusens/cloud-init/snappy/+merge/243420
Your team cloud init development team is requested to review the proposed merge of lp:~sergiusens/cloud-init/snappy into lp:~smoser/cloud-init/snappy.
References