I don\'t know what the deal is here…
So I want to run an applescript: sudo osascript myscript.scpt
sudo osascript myscript.scpt
This works fine in the terminal, but not when
The best secure method is to use the crontab. ie Save all your commands in a database say, mysql table and create a cronjob to read these mysql entreis and execute via exec() or shell_exec(). Please read this link for more detailed information.