You are not logged in.

#1 2014-04-11 13:06:10

netpumber
Member
Registered: 2009-09-20
Posts: 134

[SOLVED] cron job cannot be executed

Hi.

Im trying to execute an gtk app through cron but doesn't seem to work. Here is the content of my ~/.crontab file

#export DISPLAY=:0.0
# Execute backup reminder once a month
* * * * * /home/n3t/bin/backUpReminder/backup_reminder --display=:0.0

Any idea ?

Last edited by netpumber (2014-04-11 16:00:58)

Offline

#2 2014-04-11 13:16:53

barto
Member
From: Budapest, Hungary
Registered: 2009-10-22
Posts: 88

Re: [SOLVED] cron job cannot be executed

The crontab file (which is not the one you mentioned) should be edited through executing

crontab -e

(Refer to man crontab)


“First principle, Clarice. Simplicity” – Dr. Hannibal Lecter

Offline

#3 2014-04-11 13:22:12

ball
Member
From: Germany
Registered: 2011-12-23
Posts: 164

Re: [SOLVED] cron job cannot be executed

Also your interval syntax seems wrong.

@monthly is equivalent to

0 0 1 * * /path/to/script

This runs the script on the first of every month at midnight. If the machine is not up at that time, the job will be missed.

Last edited by ball (2014-04-11 13:23:02)

Offline

#4 2014-04-11 14:21:23

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] cron job cannot be executed

~/.crontab seems a weird place for the crontab.
Does this script work if you run it manually?

Offline

#5 2014-04-11 14:43:51

netpumber
Member
Registered: 2009-09-20
Posts: 134

Re: [SOLVED] cron job cannot be executed

First of all, if i run crontab -e , it opens a file with vim (?) from /tmp/crontab.4R2Ww0 that i cannot edit. I press insert but doesn't work.

Also your interval syntax seems wrong.
@monthly is equivalent to

Yes i know that. I change it to test if it will run in the next minute.

~/.crontab seems a weird place for the crontab.
Does this script work if you run it manually?

Hmm.. how to run it manually? i cannot understand.

Offline

#6 2014-04-11 15:01:28

ball
Member
From: Germany
Registered: 2011-12-23
Posts: 164

Re: [SOLVED] cron job cannot be executed

netpumber wrote:

First of all, if i run crontab -e , it opens a file with vim (?) from /tmp/crontab.4R2Ww0 that i cannot edit. I press insert but doesn't work.

Try another editor, e.g. nano:
Either

VISUAL=nano crontab -e

or

EDITOR=nano crontab -e

should work. (You should set these environment variables permanently to the editor of your liking.)

Edit the file, save with Ctrl-o, exit with Ctrl-x. On my machine crontab then writes the file into /var/spool/cron/

netpumber wrote:

Hmm.. how to run it manually? i cannot understand.

Just run the script, that you referenced in the crontab file, manually from the command line to be sure that the script doesn't contain errors...

Last edited by ball (2014-04-11 15:11:31)

Offline

#7 2014-04-11 16:00:44

netpumber
Member
Registered: 2009-09-20
Posts: 134

Re: [SOLVED] cron job cannot be executed

Hmm ok now it works smile Thank you very much

Offline

#8 2014-04-11 16:44:45

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: [SOLVED] cron job cannot be executed

What did you do to make it work? Other people may learn something from your solution.

Offline

#9 2014-04-11 16:54:01

netpumber
Member
Registered: 2009-09-20
Posts: 134

Re: [SOLVED] cron job cannot be executed

the ~/.crontab file doesn't need to exist there. If you run VISUAL=nano crontab -e it creates a file in /var/spool/cron and that's all.

In my i situation i think the problem was the editor.

Offline

#10 2014-04-11 23:15:44

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] cron job cannot be executed

If you run into some problems, you can always check if the wiki can help:
https://wiki.archlinux.org/index.php/Cr … ult_editor
https://wiki.archlinux.org/index.php/Vi … d_quitting

Offline

Board footer

Powered by FluxBB