LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-03-2014, 05:55 AM   #1
desiretolearn
LQ Newbie
 
Registered: Jan 2014
Posts: 25

Rep: Reputation: Disabled
overcome the error


i want to run my script using cron for every minute it must terminate after specified number of execution
my code
head -n 2 samp.csv > a.csv

Last edited by desiretolearn; 02-04-2014 at 05:04 AM.
 
Old 02-03-2014, 06:29 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
First error is because the space after [ and before ] are mandatory:
Code:
if [ $run -eq 10 ]; then
The second one is because variables names cannot start with a number as in 1=1000.
 
Old 02-03-2014, 06:41 AM   #3
desiretolearn
LQ Newbie
 
Registered: Jan 2014
Posts: 25

Original Poster
Rep: Reputation: Disabled
it is still stating that
head: cannot open `samp.csv' for reading: No such file or directory
sed: can't read samp.csv: No such file or directory
tail: cannot open `samp.csv' for reading: No such file or directory
tac: cannot open `samp.csv' for reading: No such file or directory
split: cannot open `samp.csv' for reading: No such file or directory

what might be the reason??
 
Old 02-03-2014, 06:47 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Well, the file samp.csv is not inside the current working directory.
 
1 members found this post helpful.
Old 02-03-2014, 06:47 AM   #5
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,505

Rep: Reputation: 394Reputation: 394Reputation: 394Reputation: 394
You need to give the full path to the file - it cannot find it in the current directory.
 
1 members found this post helpful.
Old 02-03-2014, 07:17 AM   #6
desiretolearn
LQ Newbie
 
Registered: Jan 2014
Posts: 25

Original Poster
Rep: Reputation: Disabled
yup it did it work

but my counterfile
Quote:
a.log
does not increment each time when the cron is executing my script
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Mail server issue--Suggestion required aq_mishu Linux - Server 5 10-28-2010 12:29 PM
Suggestion required: Firefox crashes unexpectedly!! owaispoul Linux - General 7 02-07-2010 05:19 AM
Suggestion required for research in Linux burak Linux - General 1 08-22-2008 02:23 AM
suggestion required nsampath Linux - Software 1 04-05-2007 07:23 AM
kernel Version suggestion required mystic_durle12 Linux - Kernel 2 11-06-2006 06:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:35 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration