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.


Similar Content



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

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.

Cron Queries

Hi,

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

Thanks in advance.

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?

How To Learn Linux Effectively - How Long To Devote, What To Focus On?

Hi all,

Apologies if this is off-topic. I searched a while and couldn't find out whether or not the Newbie forum is strictly for technical questions or not.

I am new to Linux and have been using it the past 4 months or so. Currently I work in a support job as an MS technician. I'm mostly using it to advance my career. Management told me if I devote time to learning Linux to the point where I can do very basic maintenance tasks on the company Linux servers, and the ability to support our few Linux clients, I would be promoted to a senior support position.

One of the greater challenges so far is trying to figure out WHAT to focus on and how long to devote to it each day. I find that if I spend multiple hours/day trying to learn Linux (like 2-3 hours), I don't retain much of what I've learned. Conversely, if I don't spend enough time each day, I worry that I will not learn enough to become proficient in a reasonable amount of time. I sometimes start reading up on a Linux topic, for instance, how to send mail to users, and wonder if my time could be better spent learning another aspect. Then again, I feel like a lot of this basic knowledge can be built upon.

I'd like to become proficient enough to achieve this senior position in 1.5-2 years. Given my current job and personal responsibilities I am able to devote 1-2 hours of learning Linux each day.

In that amount of time, I've been learning new bash commands daily and practicing yum, tried setting up a web server, extracting/compiling software, messing around with inittab, cron jobs, etc. very basic things and building upon that.

Does this sound reasonable? I'd very much appreciate some pointers and to see if I am on the right track from a Linux community perspective.

Thanks.

What Happens With The /boot Directory Is Full In Ubuntu 12.04.5?

Hi. I think because the auto-update is on, old kernels and their dependencies continuously fill up the /boot partition. Can someone tell me if this is an issue? That is, will it affect cron jobs or any other process on the virtual machine?

I just figured out how to manually purge them using the command prompt. But it seems to be a design flaw in Ubuntu, no?

Samba Won't Start/stop Via Webmin -- Ubuntu 12.04

I have a vps with Ubuntu 12.04 that I'm in the process of configuring. I have configued samba and been able to mount a share from my local computer to my samba share on my remote vps.

The issue is that when I go into the Samba server module and I click start, stop or restart it has no effect what so ever. I can ssh into the terminal and run $ sudo service smbd start and that will work (as well as stop/restart). However it will not work within Webmin.

I then went to the module configuration and changed the start command to: service smbd start and the same for the stop command (with "stop" though).

I then when to System > Running processes and saw that smbd is running however the list is showing "is running now" as NO. I click the start/stop button within this section and it doesn't work again.

Can anyone please help me figure this out?

Webmin 1.5.9
Ubuntu 12.04

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

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.

Cron Ignoring Changes Made In File

Hi,

i have a small problem on my system... I recently wrote a small bash script and added it via crontab -u root -e and it's executed as it should.
Then a few days after i did edit my bash script, but once it is run by cron it doesn't reflect the changes i made to the script. I did manually restart crond, tryed sync, moved my script, renamed it even rstart the server - no success.
If i run my script manually it returns me the expected output.
part of my script (/root/sd.sh):
Code:
#!/bin/sh

echo -n "Checking Raid... "
RAID=`tw-cli /c0/u0 show status | cut -c17-31 | grep -ci OK`
RAIDSTATUS=`tw-cli /c0/u0 show status | head -n1 | cut -c17-31`
if [ $RAID -eq 0 ]; then
  VERIFYING=`tw-cli /c0/u0 show status | cut -c17-31 | grep -ci VERIFYING`
  REBUILDING=`tw-cli /c0/u0 show status | cut -c17-31 | grep -ci REBUILDING`
  if [ $VERIFYING -eq 1 ]; then
    CURRENTSTATUS=`tw-cli /c0/u0 show verifystatus | head -n1 | cut -c46-49`
  fi
  if [ $REBUILDING -eq 1 ]; then
    CURRENTSTATUS=`tw-cli /c0/u0 show rebuildstatus | head -n1 | cut -c47-50`
  fi
  echo "Raid is busy (Raid $RAIDSTATUS$CURRENTSTATUS)"
  exit 1
fi
echo "Raid is idle (Raid $RAIDSTATUS)"

echo -n "Checking for logged in Users... "
USERS=`who | wc -l`
if [ $USERS -gt 0 ]; then
  echo "Users online"
  exit 1
fi
echo "None logged in"

crontab -l :
Code:
root@monster:~# crontab -l
# 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 * * * * /root/sd.sh | logger
*/30 * * * * /root/dropbox.sh > /dev/null

syslog:
Code:
Mar 21 09:10:01 monster /USR/SBIN/CRON[3998]: (root) CMD (/root/sd.sh | logger)
Mar 21 09:10:01 monster logger: Checking Raid... Raid is busy (Raid )
Mar 21 09:17:01 monster /USR/SBIN/CRON[4045]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Mar 21 09:20:01 monster /USR/SBIN/CRON[4105]: (root) CMD (/root/sd.sh | logger)
Mar 21 09:20:01 monster logger: Checking Raid... Raid is busy (Raid )
Mar 21 09:30:01 monster /USR/SBIN/CRON[4266]: (root) CMD (/root/sd.sh | logger)
Mar 21 09:30:01 monster /USR/SBIN/CRON[4265]: (root) CMD (/root/dropbox.sh > /dev/null)
Mar 21 09:30:01 monster logger: Checking Raid... Raid is busy (Raid )

when i run sh /root/sd.sh
Code:
root@monster:~# sh /root/sd.sh
Checking Raid... Raid is idle (Raid OK)
Checking for logged in Users... Users online
root@monster:~#

Any ideas why? - any help or thoughts appreciated

regards
Pat