Tiny Core Linux
Off-Topic => Off-Topic - Tiny Tux's Corner => Topic started by: remus on March 08, 2012, 10:40:40 PM
-
Hi all :)
I've remastered tinycore to always fire up cron for me, so I can schedule some backups to another machine on our network.
I did a search for cron related files on tinycore 3.8.4 and found the following
$ sudo find / -name "*cron*"
/etc/init.d/services/crond
/usr/bin/crontab
/usr/sbin/crond
/sys/bus/pci/drivers/JMicron IDE
/var/spool/cron
/var/spool/cron/crontabs
/var/run/crond.pid
I'm guessing that I should use /var/spool/cron/crontabs ?
Its recommended here as well : http://www.pathname.com/fhs/pub/fhs-2.3.html#VARSPOOLCRONCRONANDATJOBS
Thanks in advance for your comments.
Once I setup this regular backup management will put some important files onto the test samba server for a few weeks and then review the outcome :)
-
Use the crontab command.
-
Thanks for the input gerald_clark
tc@box:~$ crontab -e
Can't open display:
tc@box:~$ crontab -l
tc@box:~$
I'm a bit stuck.
-
Looks like your remaster is broken.
You should not be getting htat error.
-
I guessed that the problem had something to do with the system not having an editor set to open the crontab file for editing.
So googled a bit and found the following page
http://www.adminschoice.com/crontab-quick-reference
With the following bit of help
export EDITOR=vi ;to specify a editor to open crontab file.
Running that command gets things working when I run
crontab -eNow a blank file is opened with the following at the bottom
- /var/spool/cron/crontabs.2224 0/0 100%
Sooo..... I'll try booting up a stock tinycore 3.8.4 disc with bootcode cron and see if it behaves the same.
-
I have "export EDITOR=vi" in my .ashrc, so you may be on to something.
-
Booting up with another computer using a stock tinycore 3.8.4 cd with bootcodes syslog cron
- Boot up is fine.
- running crontab -e from CLI fires up the GUI editor
------------------
The system I was actually testing is running tinycore 3.8.4 (NOT microcore), and is a headless server with no keyboard or mouse either.
I'm accessing it with putty and getting that error when i run "crontab -e" So I guess that its trying to edit crontab files with the gui editor, but is failing as I'm in a CLI via putty.
So I would guess that if i was using a microcore boot disc it would use vi and not the GUI editor. What do you think ?
-
I think you are correct.
-
I've been reading up about using cron, and think I may need some help.
I've created a basic sh script
#!/bin/sh
echo "The date/time is : $(date)" >> timelog ;
When I run the file from the cli it appends the current date/time to the file timelog
Now in order to test that i am learning how to use cron correctly, I want to make sure this happens every minute.
So I ran "crontab -e"
And created the following file
SHELL=/bin/sh
PATH=/usr/sbin:/usr/bin
# Jobs
* * * * * sh /home/tc/update.log.sh
I used nano to create "/etc/cron.allow" with the following contents
root
tc
And I monitor the contents of timelog with
tail -f timelog
However, the expected date/time info is not being appended to the file.
I have looked around on a few websites, and i'm pretty sure that I've got he correct cron format for a job every 1 minutes.
Your comments and suggestions are welcome.
-
And just where do you think "timelog" will be located?
Use an absolute path.
-
Hi remus
If you run crontab -l does it list your job?
-
Thanks for your tip gerald_clark,
I've updated the update.log.sh file
from
#!/bin/sh
echo "The date/time is : $(date)" >> timelog ;to
#!/bin/sh
echo "The date/time is : $(date)" >> /home/tc/timelog ;to include absolute path's
both files are in my tc home dir
I added the following to /opt/.filetool.sh
var/spool/cron
etc/cron.allow
I made a backup with "filetool.sh -b"
and rebooted, just in case that would help, but its still not working.
Hi Rich,
Heres my output from "crontab -l"
$ crontab -l
SHELL=/bin/sh
PATH=/usr/sbin:/usr/bin
# Jobs
* * * * * sh /home/tc/update.log.sh
-
I did a google search for
cron troubleshooting
And found some useful tips at this website.
http://kb.mediatemple.net/questions/1588/Troubleshooting+common+issues+with+cron+jobs#gs
After making sure I used ONLY "absolute paths" and making a few changes to file permissions, it started working just fine.
Thanks guys :)