1

I created some bash scripts within the cron.hourly folder to run some tasks hourly when a machine is on.

The cron_pull and cron_update_images scripts work just fine within the cron job.

53 * * * 2 /etc/cron.hourly/cron_pull
55 * * * 2 /etc/cron.hourly/cron_update_images
57 * * * 2 /etc/cron.hourly/cron_start_slideshow    #This is the problem script

The final script does not run as expected and I'm not sure why. If I run the script manually, it starts the slideshow no problem. Here is the code inside cron_start_slideshow.

# Code that will prevent duplicate cronjobs from happening
PIDFILE=~/Documents/scripts/cron_pull.pid
if [ -f $PIDFILE ]
then
  PID=$(cat $PIDFILE)
  ps -p $PID > /dev/null 2>&1
  if [ $? -eq 0 ]
  then
    echo "Process is already running"
    exit 1
  else
    # Process not found, assume it is not running
    echo $$ > $PIDFILE
    if [ $? -ne 0 ]
    then
      echo "Could not create PID file"
      exit 1
    fi
  fi
else
  echo $$ > $PIDFILE
  if [ $? -ne 0 ]
  then
    echo "Could not create PID file"
    exit 1
  fi
fi

# Start the slideshow of images
eog --slide-show /media/images

# Remove the PID file showing the process is complete
rm $PIDFILE

Anything helps, thanks!

1

First of all, I think what you want to do is start this slideshow when the window manager is started, so start it with autostart script depending on which window manager you are. If its not the case, you'll have to say to any of your program that you want to connect to a specified display when you run it from the init scripts.

So did you try to add the display variable you can find in the man eog page like eog --display=0.0 --slide-show /media/images

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.