1

In the crontab -u pi -e of my digital picture frame I have got two processes.

The first one calls feh on reboot and starts a slide show.

@reboot bash /home/pi/ledslide1.sh >> /home/pi/logs/slidelog 2&>1

And then other instances should be started at certain times.

15 8 * * * bash /home/pi/ledslide2.sh >> /home/pi/logs/slidelog 2&>1
15 9 * * * bash /home/pi/ledslide3.sh >> /home/pi/logs/slidelog 2&>1
...

But the feh slide show is running on repeat. That way I have to kill the process first right? timeout is not working, because I don’t know when the reboot takes place?

0

2 Answers 2

2

In your ledslide.sh scripts, just use pkill -9 feh to kill feh. No need to keep track of PIDs or anything. pkill is used to search for and kill processes with a given name. I suggesting reading the manpage for pkill and pgrep.

2
  • I did put this command in the crontab. But it is more or less the same?
    – Markus
    Sep 13, 2015 at 18:50
  • Yes, thank you. I will take that into account.
    – Markus
    Sep 13, 2015 at 21:34
1

This has worked for me so far:

@reboot bash /home/pi/ledslide1.sh >> /home/pi/logs/slidelog 2&>1
15 8 * * * pkill -9 feh && bash /home/pi/ledslide2.sh >> /home/pi/logs/slidelog 2&>1

The .sh file invokes feh and puts it into the background. pkill -9 [KEYWORD] closes the feh process.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .