You are not logged in.
Hello
I've been using a simple bash script to check if a process is running and relaunch (because it crashes when my internet goes out periodically).
The script works perfectly fine when I call it manually, but when I run it through crontab it doesn't launch terminator. The part that logs the timestamp of the relaunch works though so the cron timer is working I think.
Can someone point me in the right direction here please? I removed the logging part trying to fault find so this is the script now. Do I need to change a permission or something to allow cronie to launch a terminal?
SHELL=/bin/bash
result=`ps -ef | grep -i "process" | grep -v "grep" | wc -l`
if [ $result -ge 1 ]
then
echo Status: OK
else
exec terminator -x "/home/user/Downloads/process"
fiLast edited by linz827 (2021-05-26 08:58:41)
Offline
Offline
Thank you very much sir. I didn't realize I was launching an X.org application. My script was overly complex too I've realized but it's working now. Thanks for the pointer.
#!/bin/bash
if pgrep -x "process" > /dev/null;
then
echo Process Status: OK
else
exec terminator -e "process" && date >> /home/user/scripts/logs
fiLast edited by linz827 (2021-05-26 09:03:20)
Offline