advertisement
Forums

The Forum is sponsored by 
 

AAPL stock: Click Here

You are currently viewing the Tips and Deals forum
How to automatically execute Terminal script 3x/day, every day?
Posted by: blusubaru
Date: March 10, 2008 09:32AM
Maybe this is the wrong way to go about doing it, but I want to write a script that will either: 1. ping our FTP website
2. login to the FTP site

if either fails, send an email. Basically a low-level system check to repeat three times a day, every day.

I've made a Terminal shell script to login, I've also tried with Automator. I'm afraid this is a little more advanced than I can produce. I can't join the two parts: the check and the email portion. How can I bridge the gap between the Terminal script and the email, but only on a connection failure?



Edited 1 time(s). Last edit at 03/10/2008 09:32AM by blusubaru.
Options:  Reply • Quote
Re: How to automatically execute Terminal script 3x/day, every day?
Posted by: Paul F.
Date: March 10, 2008 10:03AM
Cronnix will run scripts on a schedule...
I'm sure there's a non-GUI way to do it, but Cronnix puts a face on it us mere mortals can mostly understand,..



Paul F.
-----
A sword never kills anybody; it is a tool in the killer's hand. - Lucius Annaeus Seneca c. 5 BC - 65 AD
----
Good is the enemy of Excellent. Talent is not necessary for Excellence.
Persistence is necessary for Excellence. And Persistence is a Decision.

--

--

--
Eureka, CA
Options:  Reply • Quote
Re: How to automatically execute Terminal script 3x/day, every day?
Posted by: ztirffritz
Date: March 10, 2008 10:23AM
CRON is the terminal way to do it.



**************************************
MacResource User Map: [www.zeemaps.com]#
Options:  Reply • Quote
Re: How to automatically execute Terminal script 3x/day, every day?
Posted by: blusubaru
Date: March 10, 2008 10:52AM
What about AppleScript? I've never messed with it before. I'm playing with duplicates of some scripts on my system already. I've got a script setup to send an email and a script to open the FTP connection, but I still can't bridge the gap. Also, on the email script, there's an awful lot of human input needed (whom should I sent to, subject title, etc....)
Options:  Reply • Quote
Re: How to automatically execute Terminal script 3x/day, every day?
Posted by: Paul F.
Date: March 10, 2008 11:00AM
I'm drawing a complete blank on the syntax, but it's very simple to have an applescript play a terminal script...
I've even done it...

I think I need more caffeine this morning, it's still not coming to me..

But here's the URL for Cronnix;
[www.abstracture.de]



Paul F.
-----
A sword never kills anybody; it is a tool in the killer's hand. - Lucius Annaeus Seneca c. 5 BC - 65 AD
----
Good is the enemy of Excellent. Talent is not necessary for Excellence.
Persistence is necessary for Excellence. And Persistence is a Decision.

--

--

--
Eureka, CA
Options:  Reply • Quote
Re: How to automatically execute Terminal script 3x/day, every day?
Posted by: Paul F.
Date: March 10, 2008 11:06AM
Ah HA..
Just dug out an example AppleScript that calls a shell script..


do shell script "cancel -a -"

So the releveant part is "do shell script", then the name of the shell script.
Unless your script is in the default shell scripts folder (and I don't recall where that is), you'll need to provide a path also.

(by the way, "cancel -a -" cancels all print jobs to all printers... I made it part of a log-in script).



Paul F.
-----
A sword never kills anybody; it is a tool in the killer's hand. - Lucius Annaeus Seneca c. 5 BC - 65 AD
----
Good is the enemy of Excellent. Talent is not necessary for Excellence.
Persistence is necessary for Excellence. And Persistence is a Decision.

--

--

--
Eureka, CA
Options:  Reply • Quote
Re: How to automatically execute Terminal script 3x/day, every day?
Posted by: Lux Interior
Date: March 11, 2008 02:03AM
Write a simple shell script that:

1) runs the other scripts (e.g. name it server_test.scr)
2) then executes this command:

echo "sh shellfile" | at -f /pat/to/file/server_test.scr now + 8 hours

Save the file and change the permissions to allow execution.

Then execute the script.
Options:  Reply • Quote
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 204
Record Number of Users: 186 on February 20, 2020
Record Number of Guests: 5122 on October 03, 2020