I need to make Linux Ubuntu platform automatically start and kill one process, for example, if time is 8am process starts, if time is 7pm process is killed, and that have to be every day, and should be quite okay, if time interval will be easy to change.
I'm trying to use simple codes in crontab:
28 12 * * * /home/pi/Desktop/start.sh
50 11 * * * pkill led.py
Don't look at times, I've tried to change them, start.sh
starts led.py
script, but I cant stop it if I'm using pkill -9 -f led.py
. The process gets killed, but LEDs won't turn off. If I manually start the program and then kill it with Ctrl+c, the LEDs turn off. Where is the problem? Why I can't kill the process and at the same time turn off the LEDs?
kill
/pkill
command?kill -2 led.py
like this?kill -2 pid
, wherepid
is the process id. Orpkill -2 led.py
.