Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
54
rated 0 times [  54] [ 0]  / answers: 1 / hits: 14502  / 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

 Answers
6


You can set up a separate anacron instance to run in user mode:




  1. Create a .anacron folder in your home directory and in it two subfolders, etc and spool:



    mkdir -p ~/.anacron/{etc,spool}

  2. 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

  3. Add the following line to your crontab using crontab -e:



    @hourly /usr/sbin/anacron -s -t $HOME/.anacron/etc/anacrontab -S $HOME/.anacron/spool


[#33418] Sunday, May 8, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
itteast

Total Points: 291
Total Questions: 123
Total Answers: 104

Location: Tuvalu
Member since Wed, Mar 29, 2023
1 Year ago
;