anacron for user

anacron for user

am 13.12.2006 17:27:25 von Robert Lambe

I want to use anacron for my daily jobs (under my user, not as root) as my
machine is switched on and off at irregular times.

What's the best place to start anacron from? .bashrc springs to mind
although that is run for every login. On the other hand it won't do any
harm as the timestamp files will ensure that the jobs are only run once a
day.

Any better ideas?

Re: anacron for user

am 05.01.2007 15:24:46 von stefano.sabatini-lala

On 2006-12-13, Tarlika Elisabeth Schmitz wrote:
> I want to use anacron for my daily jobs (under my user, not as root) as my
> machine is switched on and off at irregular times.
>
> What's the best place to start anacron from? .bashrc springs to mind
> although that is run for every login. On the other hand it won't do any
> harm as the timestamp files will ensure that the jobs are only run once a
> day.
>
> Any better ideas?
>
>

Sory for the slow reply.

Start it from your profile script (as well as other daemons), for
example with (you have to create before the ~/etc and ~/var/spool
dirs).

anacron -t ~/etc/anacrontab -S ~/var/spool/anacron

Remeber that ~/.bashrc is for interactive use, while /etc/profile and
~/profile are executed per-session, and you should be able to load the
profile script at the start of every textual/graphical session (you
could need to add a script to execute in /etc/X11/Xsession.d as this:

# load the global profile in the /etc/X11/profile and in the
# $USER/.profile file

SYS_PROFILE=/etc/profile
USER_PROFILE=$HOME/.profile

if [ -e $SYS_PROFILE ]; then
. $SYS_PROFILE
fi

if [ -e $USER_PROFILE ]; then
. $USER_PROFILE
fi

Or you could for example add a line with
.. ~/profile
at the beginning of your ~/.Xsession (names could sligthly change
depending on your Unix system).

HTH