[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] MacPerl script to trigger restart?



Davey <davey23@iquest.net> writes:
}Hi again...
}
}Thanks for the advice on the SMTP by the way... looks like I have that one
}licked.
}
}Anyway, I wondered if any of you know of a way to trigger a Mac restart
}from a perl script?  Any libraries you can point me to?

The Finder is supposed to have an Applescript "restart" command, so this
should work (obviously I'm not going to test it!)

MacPerl::DoAppleScript(<<END);
tell application "Finder"
	restart
end tell
END


}
}The reason I am interested in this one is because I'd like to write a
}program I can trigger by sending a command via the web.  In this way I
}could restart the computer and reboot everything if something went down and
}I was not around the machine.  Really good if I am at work and I need to
}get at something but NetPrez goes down.  If the PPP goes down and back up
}NP breaks, but Quid Pro Quo, my web server, doesn't.


You and everyone else that can reach the URL.  I hope you require
authentication or restrict access for the CGI that does this.  But if
things are breaking on your Mac, the Finder may not be able to restart.

I have an Apple Geoport Express Modem, which has a tradition of dropping
the connection.  The way I keep NetPresenze happy is to have a stay-open
Applescript application always running when I'm online which once a minute
checks the status of the PPP connection (OT/PPP comes with a very useful
OSAX).  If it finds that it's broken, it quits NetPresenze and a couple of
others that I run that may cause problems (UUPC, MacTCPWatcher), and then
restarts the connection and relauches the programs.  Usually this works.

}
}Thanks..
}
}
}--davey      "We now present the biggest star in the universe . . .
}                 Cliff Richards, Jr!"  -  from Thunderbirds are Go!
}http://www.in.net/~davey23                          mailto:davey23@in.net
}


---
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@pjstoaster.pg.md.us