Keeping a terminal window open after running script from crontab

I have this script

#!/bin/sh
curl -4 http://wttr.in/Colorado\ Springs

that I want to automatically execute each morning. I have my crontab entry as

* 7 * * * (path to script)

But either the script doesnt run, or it runs and then immediately closes the shell. I know that my cronjobs are running as I have other scripts for backups that run on an hourly basis but cant figure out what detail I am missing here. I found one suggestion to include $SHELL in the script but that made no difference. Any suggestions?

Answers


Usually when I have to keep the terminal open I would exec bash as my last command. I do that when I write installer script which would open terminal; do the job and get lost after that. But if there is an error then I want the terminal to stay there so that I can read the error.

exec is used to replace the current program with argument which we provide to exec.


Actually, I don't know what are you trying to achieve with this call in your crontab. Do you want to see the weather report on your terminal? Do you want to save the weather report in the file? Get it in your emails?

If you do no redirections, you'll get the report in your mail.

If you want to have it in a file, just do:

curl wttr.in/Colorado+Springs > file

If you want to have it on you terminals do

curl wttr.in/Colorado+Springs | wall

Please note that you don't need -4, http:// and you can replace \space with +.

(DISCLAIMER: I'm the author of wttr.in)


Need Your Help

What's a good practice to use forms in PHP? Can you use OOP PHP in a form?

php mysql html oop

Right now i been creating a form for a comment section, a Login section, and sending email for a site i'm doing. The code I using was from a tutorial I learned and has too much HTML in it. It was ...

Hash Functions which are used and more popular

security hash

I know the list of all hash functions is too long. I just want to know the most popular ones which are used in day to day IT practical tasks. I know MD5, SHA1, SHA2 (256 and 512) are really popular...