54
rated 0 times
[
54]
[
0]
/ answers: 1 / hits: 14503
/ 2 Years ago, sun, may 8, 2022, 4:21:23
I would like to set up a scheduled task via anacron
but I would like to do so in user mode. How can I achieve this?
More From » users
I would like to set up a scheduled task via anacron
but I would like to do so in user mode. How can I achieve this?
You can set up a separate anacron instance to run in user mode:
Create a .anacron
folder in your home directory and in it two subfolders, etc
and spool
:
mkdir -p ~/.anacron/{etc,spool}
Create a new file ~/.anacron/etc/anacrontab
with contents similar to the following:
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# period delay job-identifier command
1 10 testjob test.sh
Add the following line to your crontab using crontab -e
:
@hourly /usr/sbin/anacron -s -t $HOME/.anacron/etc/anacrontab -S $HOME/.anacron/spool