Fcron - Set up, run jobs and troubleshoot
- Install Fcron
- Ensure that an Fcron group is created
cat /etc/group | grep fcron
# Should output something like this: fcron:x:23
- Add current user to Fcron group (Need Root)
sudo usermod -a -G fcron $USER
You might have to re-login after the last command.
- Open the fcrontab
fcrontab -e
- An empty text file should open. This is where we define what tasks to run and when to run them. However, first we add the necessary environment variables
SHELL=/usr/bin/zsh
DISPLAY=:0
- Now we can tasks one per line. For eg, below given task will change wallpaper to a random picture in wallpapers folder every 5 mins (Need
feh
installed)
@ 5 /usr/bin/feh --no-fehbg --bg-fill --randomize ~/Collection/Pictures/wallpapers
What to do in case of permission errors
Remember that the folder /var/spool/fcron
should be owned by the user fcron
while the fcrontab files inside that folder should be owned by respective users. So if you have permission issues, the following commands may resolve the issues
sudo chown fcron /var/spool/fcron
sudo chown $USER /var/spool/fcron/${USER}.orig