User Tools

Site Tools


Auto start in user context

Content Rocrail Server

The user pi is used in the examples.
This is the preferred way to start the Rocrail Server automatically after reboot instead of running it as daemon in root context.


If the Rocrail Server runs on a dedicated computer like the Raspberry Pi, it would be helpful if the Server starts automatically after every reboot in user context.
There are several ways to establish this, but the crontab solution is very easy to implement.

Start script

Create a start script, in the home directory of user pi by opening an editor like vi

cd /home/pi/Rocrail
/home/pi/Rocrail/bin/rocrail -l /home/pi/Rocrail/bin

Make the script executable:

chmod +x

Shutdown option

Use this option first if everything runs perfect.
User pi is supposed to be a sudoer.

To automatically shutdown the computer after the Rocrail Server did stop, add the following line to the script:

if [ $? -eq 70 ]
  echo raspberry | sudo -S halt -p

The echo statement is followed by the password of the user. In this case its "raspberry", which is the default password of the user pi under Raspbian.

Rocrail will return 70 in case of a client shutdown command. A kill will return zero.


Add the following line at the end of the crontab list of user pi with the command crontab -e:

@reboot /home/pi/

Or directly on the command line:

(crontab -l ; echo "@reboot /home/pi/")| crontab -

Check the crontab:

crontab -l


# For more information see the manual pages of crontab(5) and cron(8)
# m h  dom mon dow   command
@reboot /home/pi/

Stop the Rocrail Server

A normal shutdown of the computer will issue to all running processes a kill command which also will shutdown the Rocrail Server normally.




  • System: Shutdown server.


SSH Shell

killall rocrail
rocrail-linux-user-en.txt · Last modified: 2021/03/02 21:51 by rjversluis