LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-10-2020, 09:00 AM   #1
shozib007
LQ Newbie
 
Registered: Nov 2020
Posts: 1

Rep: Reputation: Disabled
Question Having error while writing a cron job


Hi Everone,
As stated in the subject my question is about cron job. I have wrote a simple cron job which is stated below:

* * * * * echo Testing > /home/ipnsadmin/testing.log

But when I save the file (crontab). I am receiving this error:

crontab: installing new crontab
"/tmp/crontab.5J0icd":0: bad minute
errors in crontab file, can't install.

please note: I have tried this job with both root user and a normal user with sudo privileges. Additionally, crond service is also up and running

Your response is highly appreciated to get me out of this. I have spent lots of time but of no use.
Thanks in advance.


Shozib
 
Old 11-10-2020, 09:44 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Make sure you've no blank lines at the start of the file, no spaces before the first *

Also include details of the distro you are using as that may make a difference.
 
1 members found this post helpful.
Old 11-16-2020, 07:09 AM   #3
Rawcous
Member
 
Registered: Jan 2014
Location: Farnborough, Hampshire - UK
Distribution: SCO UNIX -> Fedora (Core) -> CentOS -> RedHat
Posts: 128

Rep: Reputation: 48
Hello,

Seems to work fine on my distro Centos 8.

As an alternative try the following:

Code:
*/X * * * * echo Testing > /home/ipnsadmin/testing.log
Where X represents the interval. Replacing X with 1 means every minute.

BUT if am correct using your entry of
Code:
* * * * * echo Testing > /home/ipnsadmin/testing.log
If your replace X with 2 it will mean execute every 2 minutes of every hour...., of every....

If your replace X with 3 it will mean execute every 3 minutes of every hour...., of every....

So simply replace X with 1

Regards,

Rawcous!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Debian daily cron job won't run, but does run in cron.hourly. sandersch Linux - General 7 05-24-2012 01:50 AM
how to abort cron if the previous cron job not yet finished? Winanjaya Linux - Newbie 2 05-22-2012 06:44 PM
linux cron job duplicate job question cpthk Linux - Newbie 4 09-11-2009 08:52 PM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 08:16 AM
Writing a cron job and ... tcv Linux - General 9 08-20-2006 04:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration