hiroshijim / cronnix

Automatically exported from code.google.com/p/cronnix
0 stars 0 forks source link

Insufficient privileges to write crontab. #4

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Whenever I try and save a simple 2 line  curl command I get

Insufficient privileges to write crontab.
If I log in as root user I CAN save 
However, the script doesn't execute by itself!
Neither does the sample Happy New Year script
* * * * * echo "Happy New Year'

Rightclick 'Run Now' and both work fine...

This is my command
//CODE start
set FILENAME = `date +"%y%m%d-%H%M%S"`
curl -o webcam/$FILENAME.jpg http://www.foo.com/webcam.jpg
//CODE end
Can someone help?

Original issue reported on code.google.com by bac...@gmail.com on 22 Jun 2009 at 12:15

GoogleCodeExporter commented 8 years ago
IS the problem an issue with simple having a command on more than one line??? 
If so, how to write the above on 
one line?

Original comment by bac...@gmail.com on 24 Jun 2009 at 2:32

GoogleCodeExporter commented 8 years ago
You'll definitely have to keep the command on a single line. If you need a 
structured script (like you seem to do) 
it's best to put it in a file and call that script from a cron command. If your 
command is not too long you can also 
concatenate the parts with ";" (execute parts regardless of success) or "&&" 
(only keep going if the previous part 
was successful).

Hope that helps,
Sven

Original comment by sven.a.s...@gmail.com on 24 Jun 2009 at 6:44

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Thanks Sven
I can save now and it works when I click 'Run Now'
However, it doesn't seem to run 'by itself'.
If I want my command to run every other minute then isn't the correct setting
*/2 * * * *
??

Original comment by bac...@gmail.com on 24 Jun 2009 at 8:57

GoogleCodeExporter commented 8 years ago
That is correct (provided the 'Minute' column is the first one). You might want 
to confirm if cron is working in 
principle by setting a simpler schedule (like an explicit time) and see if that 
works. Also, check in Terminal if 
your cron daemon is running:

[eris:~] sas% ps aux | grep cron
root      4472   0.0  0.0    76480    652   ??  Ss    3:30PM   0:00.01 
/usr/sbin/cron
sas       4523   0.0  0.0    75492    420 s005  R+    3:31PM   0:00.00 grep cron

You must have the line beginning with 'root' or else no jobs will be executed.

-sas

Original comment by sven.a.s...@gmail.com on 26 Jun 2009 at 1:32

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Thanks Sven
Yes crontab is installed, but I'm wondering if the SETUID bit set is incorrect.
My permissions are -r-sr-sr-x. How to change so they are correct?

Original comment by bac...@gmail.com on 26 Jun 2009 at 2:15

GoogleCodeExporter commented 8 years ago
Not sure which file you were looking at but either way, +s looks off. I've got:

[eris:~] sas% ls -l /usr/sbin/cron 
-r-xr-xr-x 1 root wheel 90800 May 31  2008 /usr/sbin/cron
[eris:~] sas% sudo ls -l /var/at/tabs/
total 4
-rw------- 1 root wheel 236 Jun 26 16:18 sas

Original comment by sven.a.s...@gmail.com on 26 Jun 2009 at 2:20

GoogleCodeExporter commented 8 years ago
ok very close

used  chmod -R +rw /usr/bin/crontab
and get
-rwsr-sr-x 
but think should be
-rwsr-xr-x

Original comment by bac...@gmail.com on 26 Jun 2009 at 2:30

GoogleCodeExporter commented 8 years ago
Ah, you're looking at *crontab*, that is:

[eris:~] sas% ls -l /usr/bin/crontab
-r-sr-xr-x 1 root wheel 73648 May 31  2008 /usr/bin/crontab

as you say (minus 'w').

Original comment by sven.a.s...@gmail.com on 26 Jun 2009 at 2:33

GoogleCodeExporter commented 8 years ago

Original comment by sven.a.s...@gmail.com on 3 Nov 2010 at 10:47