Create launch.sh
note: change the path to your neo-cli
#!/bin/sh
ps auxw | grep neo-cli | grep -v grep > /dev/null
if [ $? != 0 ]
then
cd /home/ubuntu/neo-cli/ && screen -d -m -t neo-cli dotnet /home/ubuntu/neo-cli/neo-cli.dll --rpc
fi
make it executable by
chmod u+x launch.sh
Run the script with cron
crontab -e
add these two lines.
@reboot /home/ubuntu/./launch.sh
*/1 * * * * /home/ubuntu/./launch.sh
What it does is
- Run
launch.sh
when the server is restart - Run
launch.sh
every 1 minute to look forneo-cli
process. if it doesn't exist then start it.