"Content-type: text/html No input file specified." Only in CRON but not when executed directly


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting "Content-type: text/html No input file specified." Only in CRON but not when executed directly
# 1  
Old 06-09-2014
"Content-type: text/html No input file specified." Only in CRON but not when executed directly

Hi gang, I have the following code inside a the file script.sh


Code:
#!/bin/bash          
todaysdate=$(date --date='7 day' +'%d')
todaysmonth=$(date +'%m')
todaysyear=$(date +'%Y')
yahoodatestring=$todaysyear$todaysmonth$todaysdate

nicedate=$(date --date='5 day' +'%A')

nice="$nicedate, $todaysmonth/$todaysdate"

dubdub='http://biz.yahoo.com/research/earncal/'
dothtml='.html'
url=$dubdub$yahoodatestring$dothtml


echo $yahoodatestring;

echo $url;


#wget -O thefile.html $url


 sed -n "/align=center>/,/<\/small>/p" thefile.html > step1.html     
 
 sed -n "/<td>/,/<\/td>/p" step1.html > step2.html
 
 sed -n '/N\/A/{s/.*//;x;d;};x;p;${x;p;}' step2.html | sed '/^$/d' > step3.html
 
 sed -n "/\">/,/<\/a>/p" step3.html > step4.html
 
 grep 'finance.yahoo' step4.html > step5.html
 
  sed 's/.\{12\}$//' step5.html > step6.html 
  
  rev step6.html | cut -c -7 | rev > step7.html
  
  cut -d '>' -f2 step7.html > step8.html
  
  php yahoo-pull.php > email.html
  
  tail -n+2 email.html > email2.txt
 
 mail -s "$(echo -e 'Companies Reporting On $nice\nContent-Type: text/html')"  email@gmail.com  <  email2.txt



when I run ./script.sh in the command line, it runs fine and I receive an email to my inbox with the script output. However, when I try to schedule it as a cron, I get an email that says

"Content-type: text/html No input file specified."

To summarize, when the script is run in the command line manually it works, but when it is in cron, I get "Content-type: text/html No input file specified."

Does anybody have any ideas why this happens?
# 2  
Old 06-09-2014
Give it a full path to email2.txt inside your script

When using cron, as well, is best to give a full path to everything and not just rely on your PATH variable
# 3  
Old 06-11-2014
Quote:
Originally Posted by Aia
Give it a full path to email2.txt inside your script

When using cron, as well, is best to give a full path to everything and not just rely on your PATH variable

I took the extra step and added a full path to every line referencing another file. It seems to be working so far....
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

3. AIX

Can we directly edit "/etc/environment" file in AIX using vi ?

Hi Is it recommended to edit the file "/etc/environment" directly using vi ? (like by adding some export something= value staements) or do we need to edit /etc/profile file in order to set the environment variables, globally to the entire AIX LPAR please suggest. (5 Replies)
Discussion started by: System Admin 77
5 Replies

4. Web Development

Why using this kind of format in Web Development <script type="text/javascript"><!-- ...//--></scrip

I am just wondering why do programmers are using this when programming the web? When you making a joomla templates and the more focus in your mind is to target the search engines then java is very important.Not to use that. (2 Replies)
Discussion started by: Anna Hussie
2 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

Creating a Shortcut (to just type "l" but it runs "ls -lah")

How do I create shortcuts? For example: I just want to type one key "l" and have it output the command of "ls -lah" I believe it's creating a file called l with 755 permissions but I'm not sure where to put the file. *if it matters, I'm on a shared hosting web server using cPanel with... (2 Replies)
Discussion started by: ijustsawmars
2 Replies

7. Shell Programming and Scripting

check input = "empty" and "numeric"

Hi how to check input is "empty" and "numeric" in ksh? e.g: ./myscript.ksh k output show: invalid number input ./myscript.ksh output show: no input ./myscript.ksh 10 output show: input is numeric (6 Replies)
Discussion started by: geoffry
6 Replies

8. Shell Programming and Scripting

grep to find content in between curly braces, "{" and "},"

problem String ~~~~~~~~~~~~~~~~~~ icecream= { smart peopleLink "good" LC "happy" , smartpeopleLink "dull" LC "sad" } aend = {smart vc4 eatr kalu} output needed ~~~~~~~~~~~~~~~~~~ smart peopleLink "good" LC "happy" , smartpeopleLink "dull" LC "sad" smart vc4... (4 Replies)
Discussion started by: keshav_rk
4 Replies

9. UNIX for Dummies Questions & Answers

grep/cat/more -- search in a txt file and display content from a specific "keyword"

Hi, I have a .txt file Sample: ===================== NEXT HOST ===================== AEADBAS001 ip access-list extended BLA_Incoming_Filter ip access-list extended BLA_Outgoing_Filter access-list 1 permit xxxxxxxxxxxxxx access-list 2 permit xxxxxxxxxxxxxx =====================... (4 Replies)
Discussion started by: I-1
4 Replies

10. UNIX for Dummies Questions & Answers

Unix "at" / "Cron" Command New Problem...Need help

Hi All, I am trying to schedule a one time job using the at command with the help of shell script for my project. The shell script should take a parameter as a command line argument from the at command itself. Is it possible to take a command line parameter for a shell script in the command... (3 Replies)
Discussion started by: Mohanraj
3 Replies
Login or Register to Ask a Question