Skip to main content
Minor formatting
AdminBee
  • 23.6k
  • 25
  • 52
  • 76

It is my first post here. 

I am creating a simple bash script which should run a python command and mail the output. However, every time the script is running via cron, half of the python output is missing. Whereas, if I run the same script manually on shell, everything works as expected.

The bash script is:

#!/usr/local/bin/python3 echo $(/usr/local/bin/python3 /home/tech2/myscript_v3_4-3.py -rs) > /home/tech2/weeklyreportoutput.txt sleep 180 echo "Data Generated on $(date +%T_%d_%m_%y)" | mail -s "Data for Weekly SYNC $(date +%A_%F_%T)" -a /home/tech2/weeklyreportoutput.txt [email protected]

Note: The python script runs max for 10 seconds and output is not more than 100 lines. I have also tried without echo, but in that case python doesn't run with -rs argument.

Any help would be really appreciated.

It is my first post here. I am creating a simple bash script which should run a python command and mail the output. However, every time the script is running via cron, half of the python output is missing. Whereas, if I run the same script manually on shell, everything works as expected.

The bash script is:

#!/usr/local/bin/python3 echo $(/usr/local/bin/python3 /home/tech2/myscript_v3_4-3.py -rs) > /home/tech2/weeklyreportoutput.txt sleep 180 echo "Data Generated on $(date +%T_%d_%m_%y)" | mail -s "Data for Weekly SYNC $(date +%A_%F_%T)" -a /home/tech2/weeklyreportoutput.txt [email protected]

Note: The python script runs max for 10 seconds and output is not more than 100 lines. I have also tried without echo, but in that case python doesn't run with -rs argument.

Any help would be really appreciated.

It is my first post here. 

I am creating a simple bash script which should run a python command and mail the output. However, every time the script is running via cron, half of the python output is missing. Whereas, if I run the same script manually on shell, everything works as expected.

The bash script is:

#!/usr/local/bin/python3 echo $(/usr/local/bin/python3 /home/tech2/myscript_v3_4-3.py -rs) > /home/tech2/weeklyreportoutput.txt sleep 180 echo "Data Generated on $(date +%T_%d_%m_%y)" | mail -s "Data for Weekly SYNC $(date +%A_%F_%T)" -a /home/tech2/weeklyreportoutput.txt [email protected]

Note: The python script runs max for 10 seconds and output is not more than 100 lines. I have also tried without echo, but in that case python doesn't run with -rs argument.

Any help would be really appreciated.

Incomplete Outputoutput from Python cmdcommand in a Bash script

ItsIt is my first post here. I'mI am creating a simple bashbash script which should run a pythonpython command and mail the output. However, everytimeevery time the script is running via croncron, half of the pythonpython output is missing. Whereas If, if I run the same script manually on shell, everything works as expected.

The bash script is:

#!/usr/local/bin/python3

echo $(/usr/local/bin/python3 /home/tech2/myscript_v3_4-3.py -rs) > /home/tech2/weeklyreportoutput.txt

sleep 180

echo "Data Generated on $(date +%T_%d_%m_%y)" | mail -s "Data for Weekly SYNC $(date +%A_%F_%T)" -a /home/tech2/weeklyreportoutput.txt [email protected]

#!/usr/local/bin/python3 echo $(/usr/local/bin/python3 /home/tech2/myscript_v3_4-3.py -rs) > /home/tech2/weeklyreportoutput.txt sleep 180 echo "Data Generated on $(date +%T_%d_%m_%y)" | mail -s "Data for Weekly SYNC $(date +%A_%F_%T)" -a /home/tech2/weeklyreportoutput.txt [email protected]

Note: The pythonpython script runs max for 10 seconds and output is not more than 100 lines. I'veI have also tried without echoecho, but in that case pythonpython doesn't runsrun with -rs-rs argument. 

Any help would be really appreciated. Thanks!

Incomplete Output from Python cmd in a Bash script

Its my first post here. I'm creating a simple bash script which should run a python command and mail the output. However, everytime the script is running via cron, half of the python output is missing. Whereas If I run the same script manually on shell, everything works as expected.

The bash script is:

#!/usr/local/bin/python3

echo $(/usr/local/bin/python3 /home/tech2/myscript_v3_4-3.py -rs) > /home/tech2/weeklyreportoutput.txt

sleep 180

echo "Data Generated on $(date +%T_%d_%m_%y)" | mail -s "Data for Weekly SYNC $(date +%A_%F_%T)" -a /home/tech2/weeklyreportoutput.txt [email protected]

Note: The python script runs max for 10 seconds and output is not more than 100 lines. I've also tried without echo but in that case python doesn't runs with -rs argument. Any help would be really appreciated. Thanks!

Incomplete output from Python command in a Bash script

It is my first post here. I am creating a simple bash script which should run a python command and mail the output. However, every time the script is running via cron, half of the python output is missing. Whereas, if I run the same script manually on shell, everything works as expected.

The bash script is:

#!/usr/local/bin/python3 echo $(/usr/local/bin/python3 /home/tech2/myscript_v3_4-3.py -rs) > /home/tech2/weeklyreportoutput.txt sleep 180 echo "Data Generated on $(date +%T_%d_%m_%y)" | mail -s "Data for Weekly SYNC $(date +%A_%F_%T)" -a /home/tech2/weeklyreportoutput.txt [email protected]

Note: The python script runs max for 10 seconds and output is not more than 100 lines. I have also tried without echo, but in that case python doesn't run with -rs argument. 

Any help would be really appreciated.

Incomplete Output from Python cmd in a Bash script

Its my first post here. I'm creating a simple bash script which should run a python command and mail the output. However, everytime the script is running via cron, half of the python output is missing. Whereas If I run the same script manually on shell, everything works as expected.

The bash script is:

#!/usr/local/bin/python3

echo $(/usr/local/bin/python3 /home/tech2/myscript_v3_4-3.py -rs) > /home/tech2/weeklyreportoutput.txt

sleep 180

echo "Data Generated on $(date +%T_%d_%m_%y)" | mail -s "Data for Weekly SYNC $(date +%A_%F_%T)" -a /home/tech2/weeklyreportoutput.txt [email protected]

Note: The python script runs max for 10 seconds and output is not more than 100 lines. I've also tried without echo but in that case python doesn't runs with -rs argument. Any help would be really appreciated. Thanks!

close