Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
cron question
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
albright
Advocate
Advocate


Joined: 16 Nov 2003
Posts: 2588
Location: Near Toronto

PostPosted: Fri Nov 21, 2014 3:11 pm    Post subject: cron question Reply with quote

I use cronie and was under the impression that if I put a
line in /etc/crontab like this:

1 * * * * wesi72600 /usr/bin/offlineimap

then at 1 minute after every hour offlineimap will run AS USER wesi72600

but I just got an error from offlineimap that a config file was missing
from ROOT's home directory

Obviously, I do not understand how cronie / cron is working.

Any advice would be appreciated.
_________________
.... there is nothing - absolutely nothing - half so much worth
doing as simply messing about with Linux ...
(apologies to Kenneth Graeme)
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9679
Location: almost Mile High in the USA

PostPosted: Fri Nov 21, 2014 5:15 pm    Post subject: Reply with quote

I don't know much about cronie, but classic vixie-cron does not support changing users directly (the "do one thing and do it well" mantra) - so you do this by using su -c as a part of the command line in crontab.

However you have to keep in mind that you may need the script to change directories before running.

Or of course you can put it in that user's crontab file.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Fri Nov 21, 2014 5:50 pm    Post subject: Reply with quote

eccerr0r wrote:
Or of course you can put it in that user's crontab file.

That's the best choice, yeah:
Code:
crontab -u apache -e
for example.
Back to top
View user's profile Send private message
albright
Advocate
Advocate


Joined: 16 Nov 2003
Posts: 2588
Location: Near Toronto

PostPosted: Fri Nov 21, 2014 6:30 pm    Post subject: Reply with quote

thanks for the advice, which is good

but ... the problem was that offlineimap for reasons I do not
understand required its config file to be at / so I misunderstood
the message

cronie can run jobs as particular users without problem

I am the idiot :(
_________________
.... there is nothing - absolutely nothing - half so much worth
doing as simply messing about with Linux ...
(apologies to Kenneth Graeme)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum