Associate
- Joined
- 18 Oct 2002
- Posts
- 1,984
- Location
- Swindon
I've got a simple bash script that runs perfectly fine from the command line, but when i try to set it to run via Crontab, it ignores part of the script. The script is a simple one that fires a few commands via an RCON client into my rust server via 'wscat' Ive got a feeling that its something to do with the length, and complexity of the command, but not being a linux wizard, and stuck, can anyone help. I know the script is working as the date/time is input to the log file, but the wscat command are missed.
Heres the script,
#!/bin/bash
PATH=/usr/lib/node_modules/wscat:/home/rustserver:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin
date >> /home/rustserver/restartlog
wscat -c ws://Server
ort/XXXXXX -x '{"Identifier":1,Message:"global.say The Server is restarting for its Daily Restart",Name:"WebRcon"}' >> /home/rustserver/restartlog 2>&1
wscat -c ws://Server
ort/XXXXXX -x '{"Identifier":1,Message:"global.say Get somewhere safe - you have 5 minutes",Name:"WebRcon"}' >> /home/rustserver/restartlog 2>&1
wscat -c ws://Server
ort/XXXXXX -x '{"Identifier":1,Message:"global.restart",Name:"WebRcon"}' >> /home/rustserver/restartlog 2>&1
date >> /home/rustserver/restartlog
Heres the script,
#!/bin/bash
PATH=/usr/lib/node_modules/wscat:/home/rustserver:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin
date >> /home/rustserver/restartlog
wscat -c ws://Server

wscat -c ws://Server

wscat -c ws://Server

date >> /home/rustserver/restartlog