You are not logged in.

#1 2009-02-03 15:33:57

Stalafin
Member
From: Berlin, Germany
Registered: 2007-10-26
Posts: 617

[Solved] Setting a cronjob for my user

I want to create a cronjob speficially for my user to run offlineimap, so that it is run by my user.

I do not understand, however, how to do that... When I run crontab -e as my user I am getting redirected to some file in /tmp/ ...


EDIT: Exactly what was needed... Now it is working, it seems.


If I get errors with the command I am running, where are they printed to? to /var/log/crond?


Also.... I don't have the feeling the command is actually executed; I don't see mails popping up in my account.



EDIT: Everything works nicely...

Last edited by Stalafin (2009-02-03 22:45:34)

Offline

#2 2009-02-03 19:08:33

Vintendo
Member
From: Netherlands
Registered: 2008-04-21
Posts: 375
Website

Re: [Solved] Setting a cronjob for my user

Maybe a little topic highjacking but i wondered where these crontab are saved, I'm just curious

//edit I found it. /var/spool/cron

Last edited by Vintendo (2009-02-03 19:10:00)

Offline

#3 2009-02-03 21:44:33

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,223
Website

Re: [Solved] Setting a cronjob for my user

So this is [SOLVED]...? neutral

Offline

#4 2009-02-03 22:35:09

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: [Solved] Setting a cronjob for my user

i'm confused by this thread.. anyways... as think it's applicable, i use fcron + a script to keep offlineimap running (as it tends to quit sporadically)

> sudo fcrontab -u patrick -e

!mail(no),nolog(yes)
*/5 * * * * /home/patrick/Scripts/mailup

and the mailup script:

#!/bin/bash

if [ $(ps -A | grep offlineimap | wc -l) -eq 0 ] ; then
  offlineimap &
  exit 0
else
  exit 0
fi

and please, do mark as solved smile

edit:  fcron errors out to /var/log/{crond.log,errors.log,everything.log}

Last edited by brisbin33 (2009-02-03 22:36:56)

Offline

#5 2009-02-03 22:51:50

Stalafin
Member
From: Berlin, Germany
Registered: 2007-10-26
Posts: 617

Re: [Solved] Setting a cronjob for my user

Vintendo: Thanks for the hijack, I wondered about that as well. smile

fukawi2: Yeah, sorry; this is solved.

brisbin33: I don't understand, what is the advantage of fcron over cron?

Also, I don't keep offlineimap running, as that is not needed. In ~/.offlineimaprc, I have autorefresh deactivated. So what that leaves me with, is cron invoking offlineimap, which runs, synchronizes my mailboxes, and then quits.

I think this makes more sense than your solution. You basically have offlineimap running and check every few minutes if it is still running, right?

Last edited by Stalafin (2009-02-03 22:53:01)

Offline

#6 2009-02-03 23:41:26

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: [Solved] Setting a cronjob for my user

Stalafin wrote:

Vintendo: Thanks for the hijack, I wondered about that as well. smile

fukawi2: Yeah, sorry; this is solved.

brisbin33: I don't understand, what is the advantage of fcron over cron?

Also, I don't keep offlineimap running, as that is not needed. In ~/.offlineimaprc, I have autorefresh deactivated. So what that leaves me with, is cron invoking offlineimap, which runs, synchronizes my mailboxes, and then quits.

I think this makes more sense than your solution. You basically have offlineimap running and check every few minutes if it is still running, right?

fcron has many advantages over cron, you can check their site.

i want offlineimap running all the time and quick-syncing often so i get emails... um, when i get them.  offlineimap has a tendency to quit for no reason so i have that cronjob script that runs every five minutes, but - if offlineimap's already running it immediately exits w/o errors or consuming any extra resources.  seemed like the appropriate method to me.

oh well, glad you found a solution that works for you.

cheers,
pat

Offline

Board footer

Powered by FluxBB