Run Cron Job In Every 20 Second

I added a cron job , but I found that even set * * * * * ~my_cronjob , it only only it at EVERY MINUTE , if I want it run at every 20 second , can advise what can i do ? thx


Similar Content



Cron Queries

Hi,

In Solaris, I submit cron job using "cron -e". In RedHat Linux, how to submit a cron job?

Thanks in advance.

Perl Script Not Running Via Cron

Hi All,

I have perl script which I am trying to run on 1st Monday via cron job.
So I scheduled it as follows:

0 0 1-7 * * root ["$(date '+%a')" = "Mon"] && /usr/bin/perl script.pl

But then it didn't run so checked cron log and it seemed like its missing the command. so added a \ in front of %a and then it picked up the whole command as per cron log.

But still it didnt ran the script. I then change the script to just && echo "test">/tmp/test

Still nothing. if I run it as /usr/bin/perl script.pl it runs though

Thanks in advance.

Suppressing Password In Cron Log File While Sending Mails

Hi Team,

I have setup few jobs with separate log files and separate EMail ID's for each job in my cron.
If something fails in these jobs, cron is delivering a mail to the mail ID that I have configured in cron as MAILTO= ( can be seen in crontab -l).

In this course, few passwords are also being returned as output from failed jobs which are being emailed to MAILTO ID.

I want to suppress the password while sending the cron output to the MAIL ID's.
Can anyone please guide me in this?

Note: I am not root user so I don't have access to /etc/syslog.conf.

Cronjob Created Empty Files

Hi All,

I have facing a problem with cron job.
Actually on the client server there are some cronjob scheduled
as follows:

@daily sh_file.sh 2>&1>> /dev/null #Contact: vali.zachia@gmail.com
@hourly php demo.php 2>&1 >> /dev/null
10 2 * * * wget --no-check-certificate url 2>&1 > /dev/null #Cron IE
10 2 * * * wget --no-check-certificate url 2>&1 > /dev/null #cron EN
@daily sh script.sh
@daily sh script.sh
@daily sh script.sh
@hourly wget --no-check-certificate url 2>&1 > /dev/null
@daily wget --no-check-certificate url 2>&1 > /dev/null #Cron Poland
@daily wget --no-check-certificate url 2>&1 > /dev/null #Cron Norway
@daily wget --no-check-certificate url 2>&1 > /dev/null #Cron Portugal
10 2 * * * wget --no-check-certificate url 2>&1 > /dev/null #Cron GR
@daily wget --no-check-certificate url 2>&1 > /dev/null
@daily wget --no-check-certificate url 2>&1 > /dev/null
@daily wget --no-check-certificate url 2>&1 > /dev/null #Denmark



Cronjobs are scheduled daily/hourly.

But what happends after every hour/day there is a blank file created in a folder .

like :
hourly.1

hourly.2
hourly.3
hourly.4

and so on similary for daily scripts.

I am not sure whether these are created by cron job
So please clarify whether cronjob provides some thing like above or it is the code problem

Script Not Getting Executed Via CRON

I have a small script1 scheduled via cron to run every 20 mins to invoke script2 if script2 is not running.
When i run script1 from cmd line it works fine but when it is scheduled via cron it doesn't work. Not sure what am i doing wrong here.
I even tried to use absolute path.

Script 1
Code:
#!/bin/sh
/bin/ps -ef |/bin/grep script2.sh |/bin/grep -v $$ > /dev/null 2>&1
if [ $? -ne 0 ]
then
/usr/bin/nohup /home/user1/script2.sh &
fi

CRON LOG :
Feb 9 17:00:01 server1 crond[29771]: (user1) CMD (/home/user1/chk_script1.sh >/dev/null 2>&1)
Feb 9 17:20:01 server1 crond[21095]: (user1) CMD (/home/user1/chk_script1.sh >/dev/null 2>&1)
Feb 9 17:40:01 server1 crond[11218]: (user1) CMD(/home/user1/chk_script1.sh >/dev/null 2>&1)
Feb 9 18:00:01 server1 crond[29961]: (user1) CMD(/home/user1/chk_script1.sh >/dev/null 2>&1)

CRON JOB :
00,20,40 * * * * /home/user1/chk_script1.sh >/dev/null 2>&1

Mail Everyday Without Cron

hello,
I have to mail the status of my server everyday.
How do I write a script which will help me do so??
I DO NOT want to use cron job. Is there some other alternative using which I can accomplish my task.

Thankyou

Perplexing Cron Audio Problem

I'm running LinuxLite 2.0 32bit on a Dell 3000.

I have never come across anything like this and to tell you, I am stumped.

Here are the contents of my crontab file:

Code:
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
*/10 * * * * /usr/bin/arecord -t wav -f cd -d 42 /home/randy/Music/lanting$(date "+\%^b\%d\%y").wav


If I run this from the terminal, everything is fine. It properly records the audio:

Code:
/usr/bin/arecord -t wav -f cd -d 42 /home/randy/Music/lanting$(date "+\%^b\%d\%y").wav

If I run this as it is shown in my crontab file, it records but there is no audio recorded.:


Code:
*/10 * * * * /usr/bin/arecord -t wav -f cd -d 42 /home/randy/Music/lanting$(date "+\%^b\%d\%y").wav

What could be causing this? I tried different cron settings for example 15 14 * * 2

This recorded at 2:15pm on Tuesday (today) but no audio. Yet if I run the code as mentioned above, from the terminal without the cron settings, the recording is fine.

Any ideas what I should do?

Cron Delete ?

I found this command on my crontab, i know what is "30 3 * * * /usr/bin/php5 /home/super/public_html/index.php" but what is "Cron Delete" ?

"30 3 * * * /usr/bin/php5 /home/super/public_html/index.php Cron delete"

Is It Food Have Find Command Running In Cron Every Day Once To Delete Older Files

I need to clean-up some folder. I have a cron job which uses find command to find and delete 25 days older file.

Code:
find $FOLDER_PATH/$FOLDER -depth -regex  ^$FOLDER_PATH/$FOLDER/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ -type d -mtime +25  -exec ls -ld {} \;   >> /tmp/deleted_folders.log

When this running it occupies 1-3% of cpu. And it may take longer time based on the folder size.

Is it ok to have find command running as cron job ?

Setting CRON Job To Start At 6Pm And Stop At 6AM

I see that you can set CRON jobs to run hourly etc, but I don't see any exapmles of setting one up to start and stop at specified times.

The job I want while run continuously, once started at 6pm, until all of the records are processed or until 6am.

Can this be done?

If so, how?

PS. 6 months ago I couldn't even spell LINUX.