-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I've been trying to get the timidity system running as a daemon. I wrote the following init script: #!/bin/sh # # timidity # ### BEGIN INIT INFO # Provides: timidity # Required-Start: # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Add and remove timidity # Description: ### END INIT INFO . /etc/rc.d/init.d/functions RETVAL=0 PROG=timidity EXEC=/bin/$PROG PIDFILE=/var/run/timidity.pid function start { [[ -x $EXEC ]] || exit 5 echo -n "Starting $PROG: " $EXEC -iAD RETVAL=$? echo return $RETVAL } function stop { echo -n "Stopping $PROG: " killproc $EXEC -TERM RETVAL=$? echo return $RETVAL } case "$1" in start) start RETVAL=$? ;; stop) stop RETVAL=$? ;; status) status $PROG RETVAL=$? ;; restart) stop start ;; reload) stop start ;; *) echo $"Usage: $prog {start|stop|status|restart|reload}" exit 1 esac exit $RETVAL When run through systemctl during startup it fails: [root at tamar init.d]# systemctl status timidity timidity.service - LSB: Add and remove timidity Loaded: loaded (/etc/rc.d/init.d/timidity) Active: active (exited) since Thu ... Process: 784 ExecStart=/etc/rc.d/init.d/timidity start (code=exited, status=0/SUCCESS) ... Starting LSB: Add and remove timidity... ... Starting timidity: ... jack_client_new: deprecated ... Started LSB: Add and remove timidity. ... Cannot connect to server socket err = No such file or directory ... Cannot connect to server request channel ... jack server is not running or cannot be started ... Couldn't open output device But when run directly is works fine: [root at tamar init.d]# ./timidity start Starting timidity: TiMidity starting in ALSA server mode Opening sequencer port: 128:0 128:1 128:2 128:3 If I use # service timidity start it also fails. I _think_ that what is happening is that systemctl is stripping off the switch. I've spent a couple of hours searching for any links or explanation and got nowhere. I even knocked up a script to try and separate the two parts: #!/bin/sh cd /etc/init.d ./timidity start but to no avail. If there is a simple fix could someone point me there, if it's complex don't bother, I only need the daemon when running MIDI and can start it by hand. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJVHa+rAAoJEAF3yXsqtyBlKFUP/0olzOxF44xGa0/b1UI9LyKb 8LWLJ6XYXQfwJZvZ7N5v/r9g6WPesIuWf/TugXEz20MhrN0BhoqmUrkD9FjVnpFa B7zQxRQ/DUXs2Z/w2DCfHRs5QWr3o31EGNPw/cZtqMf2bq+Z0LXXlU6A4QozDFe8 Aq/ZYduOr5GG6D8DPRCSV2ggFGvs27I7vvp48bvCNZ4jh2dAjBSlygI42Koug2Ga UcAGllj4Litdm+O5hUpyPtsJC58umfNy4Lq9Y6HBxIpeZrioxNE+trNQHoZuzoP/ clLItDMwj990Hs7ft3eyt1oIihuCTsVQ3HOkn0fjZ0OAWPIudq7ZynzfHctMGtP2 Htx0A3coYxFFZ/fZZfYUkM4FQU6OA6fQ378u9hdxq9+XKayCh4938PZHmKjGHUTH DSu+iZVJ8DEc62pfgeLUWMidEgSu5/n5ROGIHed/wwt4nE6rGv/fz0D33ArMwD3t Ozybkt+FW2u8XK4qkA/ehgf3SBK4AIHMNg9IDWiWSaF4krQlInhKHGoCp1Xi1ISV 2C/Lb7exn2CX/Uohdhqy86HNOhHHbZ6mkOL1k8XTIIazjRWJWQ/+gkt6Bj39q+K8 NDnN03oVYsXgVz2nqFT3eQ001k/pRlkKn11ZYtEZ1fY77nzsOj+J3DD/txn8qTRi yNSvbWmxPj24hEVzSKu3 =CEIq -----END PGP SIGNATURE-----
It might be SELinux. On a standard system; when we run things as a user from the command line SELinux rules do not apply. It would explain why it works manually but not via systemd. Rather than using an init.d script you might want to try using a systemd service. I haven't tested but something like this should work. [Unit] Description=timidity daemon [Service] PIDFile=/var/run/timidity.pid User=someuser Group=someuser WorkingDirectory=/home/someuser ExecStart=/bin/timidity ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s TERM $MAINPID PrivateTmp=true On 2 April 2015 at 23:07, J Martin Rushton <martinrushton56 at btinternet.com> wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I've been trying to get the timidity system running as a daemon. I > wrote the following init script: > > #!/bin/sh > # > # timidity > # > ### BEGIN INIT INFO > # Provides: timidity > # Required-Start: > # Required-Stop: > # Default-Start: 2 3 4 5 > # Default-Stop: 0 1 6 > # Short-Description: Add and remove timidity > # Description: > ### END INIT INFO > > . /etc/rc.d/init.d/functions > > RETVAL=0 > PROG=timidity > EXEC=/bin/$PROG > PIDFILE=/var/run/timidity.pid > > function start { > [[ -x $EXEC ]] || exit 5 > echo -n "Starting $PROG: " > $EXEC -iAD > RETVAL=$? > echo > return $RETVAL > } > > function stop { > echo -n "Stopping $PROG: " > killproc $EXEC -TERM > RETVAL=$? > echo > return $RETVAL > } > > case "$1" in > start) start > RETVAL=$? > ;; > stop) stop > RETVAL=$? > ;; > status) > status $PROG > RETVAL=$? > ;; > restart) > stop > start > ;; > reload) > stop > start > ;; > *) > echo $"Usage: $prog > {start|stop|status|restart|reload}" > exit 1 > esac > exit $RETVAL > > > When run through systemctl during startup it fails: > > [root at tamar init.d]# systemctl status timidity > timidity.service - LSB: Add and remove timidity > Loaded: loaded (/etc/rc.d/init.d/timidity) > Active: active (exited) since Thu ... > Process: 784 ExecStart=/etc/rc.d/init.d/timidity start > (code=exited, status=0/SUCCESS) > > ... Starting LSB: Add and remove timidity... > ... Starting timidity: > ... jack_client_new: deprecated > ... Started LSB: Add and remove timidity. > ... Cannot connect to server socket err = No such file or directory > ... Cannot connect to server request channel > ... jack server is not running or cannot be started > ... Couldn't open output device > > But when run directly is works fine: > > [root at tamar init.d]# ./timidity start > Starting timidity: > TiMidity starting in ALSA server mode > Opening sequencer port: 128:0 128:1 128:2 128:3 > > If I use # service timidity start it also fails. > > I _think_ that what is happening is that systemctl is stripping off > the switch. I've spent a couple of hours searching for any links or > explanation and got nowhere. I even knocked up a script to try and > separate the two parts: > #!/bin/sh > cd /etc/init.d > ./timidity start > but to no avail. > > If there is a simple fix could someone point me there, if it's complex > don't bother, I only need the daemon when running MIDI and can start > it by hand. > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.22 (GNU/Linux) > > iQIcBAEBAgAGBQJVHa+rAAoJEAF3yXsqtyBlKFUP/0olzOxF44xGa0/b1UI9LyKb > 8LWLJ6XYXQfwJZvZ7N5v/r9g6WPesIuWf/TugXEz20MhrN0BhoqmUrkD9FjVnpFa > B7zQxRQ/DUXs2Z/w2DCfHRs5QWr3o31EGNPw/cZtqMf2bq+Z0LXXlU6A4QozDFe8 > Aq/ZYduOr5GG6D8DPRCSV2ggFGvs27I7vvp48bvCNZ4jh2dAjBSlygI42Koug2Ga > UcAGllj4Litdm+O5hUpyPtsJC58umfNy4Lq9Y6HBxIpeZrioxNE+trNQHoZuzoP/ > clLItDMwj990Hs7ft3eyt1oIihuCTsVQ3HOkn0fjZ0OAWPIudq7ZynzfHctMGtP2 > Htx0A3coYxFFZ/fZZfYUkM4FQU6OA6fQ378u9hdxq9+XKayCh4938PZHmKjGHUTH > DSu+iZVJ8DEc62pfgeLUWMidEgSu5/n5ROGIHed/wwt4nE6rGv/fz0D33ArMwD3t > Ozybkt+FW2u8XK4qkA/ehgf3SBK4AIHMNg9IDWiWSaF4krQlInhKHGoCp1Xi1ISV > 2C/Lb7exn2CX/Uohdhqy86HNOhHHbZ6mkOL1k8XTIIazjRWJWQ/+gkt6Bj39q+K8 > NDnN03oVYsXgVz2nqFT3eQ001k/pRlkKn11ZYtEZ1fY77nzsOj+J3DD/txn8qTRi > yNSvbWmxPj24hEVzSKu3 > =CEIq > -----END PGP SIGNATURE----- > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 SELinux certainly was causing fun and games. I copied your suggestion to /etc/systemd/user/timidity.service (mode 750) but it's still not happy: [root at tamar user]# systemctl status timidity timidity.service Loaded: not-found (Reason: No such file or directory) Active: failed (Result: exit-code) since Th... ... Starting LSB: Add and remove timidity... ... timidity.service: control process exited, code=exited status=203 ... Failed to start LSB: Add and remove timidity. ... Unit timidity.service entered failed state. ... Stopped timidity.service. I've wasted way too much time on this, I've put it in my .profile. The weirdness of systemctl will have to wait! Thanks all On 02/04/15 22:16, Andrew Holway wrote:> It might be SELinux. On a standard system; when we run things as a > user from the command line SELinux rules do not apply. It would > explain why it works manually but not via systemd. > > Rather than using an init.d script you might want to try using a > systemd service. I haven't tested but something like this should > work. > > [Unit] Description=timidity daemon > > [Service] PIDFile=/var/run/timidity.pid User=someuser > Group=someuser WorkingDirectory=/home/someuser > ExecStart=/bin/timidity ExecReload=/bin/kill -s HUP $MAINPID > ExecStop=/bin/kill -s TERM $MAINPID PrivateTmp=true > > > > > > On 2 April 2015 at 23:07, J Martin Rushton > <martinrushton56 at btinternet.com> wrote: > > I've been trying to get the timidity system running as a daemon. > I wrote the following init script: > > #!/bin/sh # # timidity # ### BEGIN INIT INFO # Provides: timidity # > Required-Start: # Required-Stop: # Default-Start: 2 3 4 5 # > Default-Stop: 0 1 6 # Short-Description: Add and remove timidity # > Description: ### END INIT INFO > > . /etc/rc.d/init.d/functions > > RETVAL=0 PROG=timidity EXEC=/bin/$PROG > PIDFILE=/var/run/timidity.pid > > function start { [[ -x $EXEC ]] || exit 5 echo -n "Starting $PROG: > " $EXEC -iAD RETVAL=$? echo return $RETVAL } > > function stop { echo -n "Stopping $PROG: " killproc $EXEC -TERM > RETVAL=$? echo return $RETVAL } > > case "$1" in start) start RETVAL=$? ;; stop) stop RETVAL=$? ;; > status) status $PROG RETVAL=$? ;; restart) stop start ;; reload) > stop start ;; *) echo $"Usage: $prog > {start|stop|status|restart|reload}" exit 1 esac exit $RETVAL > > > When run through systemctl during startup it fails: > > [root at tamar init.d]# systemctl status timidity timidity.service - > LSB: Add and remove timidity Loaded: loaded > (/etc/rc.d/init.d/timidity) Active: active (exited) since Thu ... > Process: 784 ExecStart=/etc/rc.d/init.d/timidity start > (code=exited, status=0/SUCCESS) > > ... Starting LSB: Add and remove timidity... ... Starting > timidity: ... jack_client_new: deprecated ... Started LSB: Add and > remove timidity. ... Cannot connect to server socket err = No such > file or directory ... Cannot connect to server request channel ... > jack server is not running or cannot be started ... Couldn't open > output device > > But when run directly is works fine: > > [root at tamar init.d]# ./timidity start Starting timidity: TiMidity > starting in ALSA server mode Opening sequencer port: 128:0 128:1 > 128:2 128:3 > > If I use # service timidity start it also fails. > > I _think_ that what is happening is that systemctl is stripping > off the switch. I've spent a couple of hours searching for any > links or explanation and got nowhere. I even knocked up a script > to try and separate the two parts: #!/bin/sh cd /etc/init.d > ./timidity start but to no avail. > > If there is a simple fix could someone point me there, if it's > complex don't bother, I only need the daemon when running MIDI and > can start it by hand. >> _______________________________________________ CentOS mailing >> list CentOS at centos.org >> http://lists.centos.org/mailman/listinfo/centos >> > _______________________________________________ CentOS mailing > list CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJVHcVWAAoJEAF3yXsqtyBlHDcP/2VULTDUzhuWefhRm1pqhMpi S/bOjeNIuhhmpnyPhnCg4xm5jYXFa1ix6q4RCxv70HAGXkv/dZpFOZ63/ni+nKnD 5xyjez0TLpvlYGg3sGJhbtatenwYMlCy4KdZt+JnuWNce/9cgPy8/oALxSOQfmp/ Comfk2d3BN/g7TxpNs1zPetFEW2fytbzh0IMjF7pOe5OtOPe+FMI8Y8wZSbkzd73 6I/5bmL6nWEHelI65dB4KaXDsWfGoc9ZkVbXJ2lHrx70avbuyKu9o+jD9MVYxa83 AgGUGlt7oZuuYGVLy4oR+T6c6O+LdLXgSuI79RsSBwwdwSkTLGOIT5ljDV53krum 2g93QtJyGtPL2+oCNqvcqKhkO8RVJ/i9B9huHvRYT0s9TcJ6+54nrCbv54y6zXc2 eonvwyuFtGkRPG2spOotK342dx63cus1T+vQU+d4ohBTANvSkh6NVFb0nbAbADJy FLRx3IdFRbe05Ehsb6hTTEnTZMTLNXx1EruvPJdTpA4c6j2eU35LwF/vEeOC+5Kq XESUSr6kSSgFHmZB40rt03lPcMameqIpWBVBgQln7KTkxxVY5yb/zjm7Cz9HdsUm TK96Gf+Xxf/iV6E/fZAsBLQmqbHL/6WeteF0t8qa7YcET1Y68xkJ/8Rbn1/Ers/C /DE83/mqV3dz2SQO6Di+ =iFvP -----END PGP SIGNATURE-----