crontab for mini 2440

sagar
hi,
i am in need to schedule the execution of program once at particular time,
as it is done in linux with help of "crontab".
 but how to do the same in arm board?
  is crontab available in arm?

plz help me out 

thanks in advance!!!!!

detour
chron is a Linux feature and available where ever Linux runs.

sagar
thanks Detour for replay but,
as i said i need it for FriendlyARM .. i don't found it any where.

detour
look at /usr/sbin for crond.  You need a crontab in /etc, and start crond
in your init file.

ram
hi,
 i have seen crond in /usr/sbin . but there is no crontab in /etc.
 i need help how to implement in friendly arm.

davef
If you type crontab -l on the prompt and nothing happens then you have to
enable it in kernelconfig and re-compile.

Under Busybox -> Miscellaneous Utilities

look for crond and maybe you also need Busybox crontab

Also, not much point starting another thread with the same name.  The first
post worked well.

mohan kavikondala
Dear All,

        Please explain me the procedure how to implement crontab job on
friendly arm with detailed explanation and sample code also.

davef
I doubt if anyone is going to respond with a detailed procedure when there
are hundreds of them floating around the net.

Sample code:

* * * * * /home/run-this-script.sh

every minute the script will run.

Best to do a bit of reading and then come with specific questions.

davef
ram,

Carefully re-reading your post AND the one before I don't see any
/etc/crontab entry in my working system.

If you do crontab -e you will be presented with your default editor and
then you can put your job in that file as shown in the above post.

rajkumar
hi ,
   
        when i do crontab -e it is saying that there is no file or
directory in /var/spool/cron/crontabs,
         so i have created directories in var( mkdir spool ,mkdir
spool/cron,mkdir spool/cron/crontabs ) and i have run service saying crond
start in commmand prompt then service is executed, but when the system is
rebooted or shutdown then created directories are deleted, as var is mount
directory.
        what is way overcome this problem. 
 

thanks in advance.

davef
You have to create your cron job as suggested above.

Which kernel are you running?  My /var and sub-directories are "permanently
there".  If you are using the FriendlyArm rootfs what does it say in
/etc/rcS about your /var directory? 

Are  you using an SD card or NFS or NAND?  If SD card did you do a sync
before shutting the machine down?

rajkumar
Thanks for ur reply 
         we are using linux-2.6.36.2 kernel mini 2440 friendly arm , we are
using Friendly arm rootfs where /etc/init.d/rcS having /var and its sub
directories are created, and we are using NAND .
          I think I need to re-configure the kernel image for /var and its 
 
sub-directories what are things to add for this /var/spool/cron-- is there
any alternate way to sort out this problem, is change in busybox work for
this.

davef
Show the contents of /etc/init.d/rcS.

The one I am looking at does not create /var

Also, be aware the /etc is bound to /tmp which means any change to this
file is not persistent. Whether or not this is your problem, I don't know.

rajkumar
/etc/init.d/rcS. contains





#! /bin/sh                                                                 
                                                                          
                                                                           
                                                                          
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:                         
                                                                          
runlevel=S                                                                 
                                                                          
prevlevel=N                                                                
                                                                          
umask 022                                                                  
                                                                          
export PATH runlevel prevlevel                                             
                                                                          
                                                                           
                                                                          
#                                                                          
                                                                          
#       Trap CTRL-C &c only in this shell so we can interrupt subprocesses.
                                                                          
#                                                                          
                                                                          
trap ":" INT QUIT TSTP                                                     
                                                                          
/bin/hostname FriendlyARM                                                  
                                                                          
/bin/mount -n -t sysfs none /sys                                           
    
/bin/mount -n -t usbfs none /proc/bus/usb                                  
    
/bin/mount -t ramfs none /dev                                              
    
                                                                           
    
echo /sbin/mdev > /proc/sys/kernel/hotplug                                 
    
/sbin/mdev -s                                                              
    
/bin/hotplug                                                               
    
# mounting file system specified in /etc/fstab                             
    
mkdir -p /dev/pts                                                          
    
mkdir -p /dev/shm                                                          
    
/bin/mount -n -t devpts none /dev/pts -o mode=0622                         
    
#! /bin/sh                                                                 
                                                                          
                                                                           
                                                                          
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:                         
                                                                          
runlevel=S                                                                 
                                                                          
prevlevel=N                                                                
                                                                          
umask 022                                                                  
                                                                          
export PATH runlevel prevlevel                                             
                                                                          
                                                                           
                                                                          
#                                                                          
                                                                          
#       Trap CTRL-C &c only in this shell so we can interrupt subprocesses.
                                                                          
#                                                                          
                                                                          
trap ":" INT QUIT TSTP                                                     
                                                                          
/bin/hostname FriendlyARM                                                  
                                                                          
                                                                           
                                                                          
/bin/mount -n -t proc none /proc                                           
                                                                          
/bin/mount -n -t sysfs none /sys                                           
                                                                          
/bin/mount -n -t usbfs none /proc/bus/usb                                  
                                                                          
/bin/mount -t ramfs none /dev                                              
                                                                          
                                                                           
                                                                          
echo /sbin/mdev > /proc/sys/kernel/hotplug                                 
                                                                          
/sbin/mdev -s                                                              
                                                                          
/bin/hotplug                                                               
                                                                          
# mounting file system specified in /etc/fstab                             
                                                                          
mkdir -p /dev/pts                                                          
                                                                          
mkdir -p /dev/shm                                                          
                                                                          
/bin/mount -n -t devpts none /dev/pts -o mode=0622                         
                                                                          
/bin/mount -n -t tmpfs tmpfs /dev/shm      

have a look of this RCS file

davef
Could you tell me where in this file /var is being created?

> we are using Friendly arm rootfs where /etc/init.d/rcS having /var and
> its subdirectories are created

That file looks corrupted to me.  Why the repetition?  I have a rcS from
2.6.29.4 that looks something like that.

Are you sure there is not a line like this:

/bin/mount -n -t ramfs none /var

I think that means /var and its subdirectories disappear when mini2440 is
turned off.

Would the solution be just:

mkdir -p /var (as well)

rajkumar
hi ,
  As u said i have created the directories for  var/spool/cron/crontabs and
executed the cronjobs.

   And I had added  a job in /etc/crontab file but that is not executing .



thanks in advance

davef
Well, the only way I am going to be able to help is to see your real rcS
file.

mohan kavikondala
Dear Sir,

        When ever i am adding cronjob in /etc/crontab, it is not executing.
        can u help me how to achieve this with sample code.

Thanks In advance

davef
Show us the contents of your cron job.

mohan
hi ,
   This is etc/crontab file where 'wire' is job to be executed 
but for every 1 minute wire is not executing ...  
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR
sun,mon,tue,wed,thu,f
# |  |  |  |  |
# *  *  *  *  * user-name  command to be executed
*/1 * * * * root /home/wire

davef
What do you see when you:

crontab -l

Also, what is wire? An application, C file, .sh file?  What is its file
permissions?  Can you run the file like this ./wire?

davef
./wire

no question mark

davef
putting root in my crontabs stopped them executing.

Try:

* * * * * /home/wire

You are root on the mini2440

I also some problems using */1 instead of *  I think they are suppose to
mean the same thing but Busybox crontab doesn't seem to think so.  If there
are any warning messages about a failed cron job I don't know where to look
for them.

davef
Evidently:

"Cron-related messages, including success and failure, are logged to
/var/log/cron".

I made that directory but no messages appear in it even when the jobs don't
execute.

mohan
hi,
 when i type crontab -l
nothing it is showing about the job.
"wire"is an executable of application in 'c'.
i can run ./wire.

davef
Well, then you haven't got any cron jobs.

Did you invoke the command crontab -e and then add this text

* * * * * /home/wire

and save it and wait a few minutes?

Which editor are you using on the target?

And where are you saving your cron jobs to?

mohan
Dear Sir,


         Adding job after typing crontab -e is worked on friendly arm for
me which is user level cronjob. But adding cronjob to /etc/crontab which is
system level cronjob is not working on friendly arm. PLease help me in this
aspect.

Thanks In Advance.

davef
We seem to have come full-circle here.

Have you read my comments to rajkumar?

Show me the full listing of your rcS file.

mohan
hi,

this is my rcS file where i have added cronjob.




#! /bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:
runlevel=S
prevlevel=N
umask 022
export PATH runlevel prevlevel

#
#  Trap CTRL-C &c only in this shell so we can interrupt subprocesses.
#
trap ":" INT QUIT TSTP
/bin/hostname FriendlyARM

/bin/mount -n -t proc none /proc
/bin/mount -n -t sysfs none /sys
/bin/mount -n -t usbfs none /proc/bus/usb
/bin/mount -t ramfs none /dev

echo /sbin/mdev > /proc/sys/kernel/hotplug
/sbin/mdev -s
/bin/hotplug
# mounting file system specified in /etc/fstab
mkdir -p /dev/pts
mkdir -p /dev/shm
/bin/mount -n -t devpts none /dev/pts -o mode=0622
/bin/mount -n -t tmpfs tmpfs /dev/shm
/bin/mount -n -t ramfs none /tmp
/bin/mount -n -t ramfs none /var
mkdir -p /var/empty
mkdir -p /var/log
mkdir -p /var/lock
mkdir -p /var/run
mkdir -p /var/tmp
mkdir -p /var/spool
mkdir -p /var/spool/cron
mkdir -p /var/spool/cron/crontabs

cp /task /var/spool/cron/crontabs/root
crond start

/sbin/hwclock -s

syslogd
/etc/rc.d/init.d/netd start
echo "                        " > /dev/tty1
echo "Starting networking..." > /dev/tty1
sleep 1
/etc/rc.d/init.d/httpd start
echo "                        " > /dev/tty1
echo "Starting web server..." > /dev/tty1
sleep 1
/etc/rc.d/init.d/leds start
echo "                        " > /dev/tty1
echo "Starting leds service..." > /dev/tty1
echo "                        "
sleep 1

/sbin/ifconfig lo 127.0.0.1
/etc/init.d/ifconfig-eth0

/bin/qtopia &
echo "                                  " > /dev/tty1
echo "Starting Qtopia, please waiting..." > /dev/tty1
/home/StartupARM

davef
So, your cron job is being put in

cp /task /var/spool/cron/crontabs/root

But you said, 

> But adding cronjob to /etc/crontab which is
> system level cronjob is not working on friendly arm. 

Where does this "task" come from?

davef
I thought your cron job was calling wire.

Is task a script that runs wire?

So, from root can you run:

./task

and get the expected behaviour?

Good night.

mohan
Dear Sir,

        When ever i am adding cronjob in /etc/crontab, it is not executing
on friendlyarm.
        can u help me how to achieve this with sample code.
        Can anybody help me.

Thanks In advance

evaxige
[Solved]

1. create 'spool/cron/crontabs' in yaffs2 partition, eg. /home/

2. make soft link to '/var', eg. ln -s /home/spool /var/

3. crontab -e, ...

4. modify /etc/init.d/rcS, add follow lines:
    # start crond  
    ln -s /home/spool /var/
    /usr/sbin/crond

sushant
Hello,
i am insert this commanf in rcS file 
   /bin/mount -n -t sysfs none /sys

show this signal
   mount: mounting none on /sys failed: Device or resource busy