Re: [systemd-devel] Calling shutdown while executing a service

2015-06-10 Thread Christoph Pleger
Hello,

 /usr/local/sbin/local is a bash script which calls several functions.
 When
 one of these functions fails, i.e. returns another value than zero, the
 script calls this function:

 die() {
   STRING=$1
   echo 2 Error occured in function ${STRING}
   echo Press any key to reboot (sorry for your inconvenience)
   read -n 1
   shutdown -r now
 }

 Now I have the case that one of the functions fails. But after pressing
 a
 key, the computer does not reboot immediately, but schedules the reboot
 for approximately two minutes in the future and then continues to
 execute
 functions, till the two minutes are over.

 Most likely systemd is waiting for your service (or some other
 service) to finish before it proceeds with shutting down.

 Consider issuing systemd-analyze set-log-level debug before you try
 this. This turns on debug output which might tell you what precisely
 systemd is waiting for.

I added that line at the beginning of die(), but that did not result in
additional screen messages. But I am sure that the delayed shutdown
happens because systemd is waiting for my service to finish. Is there
another way to prevent that, than adding an exit command at the end of
die()?

Regards
  Christoph

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Calling shutdown while executing a service

2015-06-09 Thread Lennart Poettering
On Tue, 02.06.15 16:19, Christoph Pleger (christoph.ple...@cs.tu-dortmund.de) 
wrote:

 Hello,
 
 I created a new target, defined by this target file:
 
 [Unit]
 Description=LOCAL
 Requires=multi-user.target
 After=multi-user.target
 Conflicts=rescue.target
 AllowIsolate=yes
 
 The new target only depends on one new service. The service is defined by:
 
 [Unit]
 Description=LOCAL
 Requires=multi-user.target
 Before=getty@tty1.service local.target
 After=multi-user.target
 
 [Service]
 Type=oneshot
 ExecStart=/usr/local/sbin/local
 StandardOutput=tty
 TTYPath=/dev/tty1
 
 
 /usr/local/sbin/local is a bash script which calls several functions. When
 one of these functions fails, i.e. returns another value than zero, the
 script calls this function:
 
 die() {
   STRING=$1
   echo 2 Error occured in function ${STRING}
   echo Press any key to reboot (sorry for your inconvenience)
   read -n 1
   shutdown -r now
 }
 
 Now I have the case that one of the functions fails. But after pressing a
 key, the computer does not reboot immediately, but schedules the reboot
 for approximately two minutes in the future and then continues to execute
 functions, till the two minutes are over.

Most likely systemd is waiting for your service (or some other
service) to finish before it proceeds with shutting down. 

Consider issuing systemd-analyze set-log-level debug before you try
this. This turns on debug output which might tell you what precisely
systemd is waiting for.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Calling shutdown while executing a service

2015-06-02 Thread Christoph Pleger
Hello,

I created a new target, defined by this target file:

[Unit]
Description=LOCAL
Requires=multi-user.target
After=multi-user.target
Conflicts=rescue.target
AllowIsolate=yes

The new target only depends on one new service. The service is defined by:

[Unit]
Description=LOCAL
Requires=multi-user.target
Before=getty@tty1.service local.target
After=multi-user.target

[Service]
Type=oneshot
ExecStart=/usr/local/sbin/local
StandardOutput=tty
TTYPath=/dev/tty1


/usr/local/sbin/local is a bash script which calls several functions. When
one of these functions fails, i.e. returns another value than zero, the
script calls this function:

die() {
  STRING=$1
  echo 2 Error occured in function ${STRING}
  echo Press any key to reboot (sorry for your inconvenience)
  read -n 1
  shutdown -r now
}

Now I have the case that one of the functions fails. But after pressing a
key, the computer does not reboot immediately, but schedules the reboot
for approximately two minutes in the future and then continues to execute
functions, till the two minutes are over.

What do I have to change to let the computer reboot immediately after the
keystroke?

Regards
  Christoph


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel