This might be a stupid question, but it would great to be able to do this. I have a custom made admin section on a website of mine. I have a cron job set to run this file once a day /opt/webalizerScript.sh however, I would like to easily be able to execute that command from my admin section any time I want a fresh update on traffic stats from webalizer. I don’t really want to edit the cron, because I don’t intend on executing the script manually very often and once per day is fine for automated purposes. Granted I know I can just execute the script in a shell, but that negates the whole purpose of what I am trying to do.
Share
While Amadan’s answer is a good overview, I thought I’d drop in a simple php script as a demonstration. This script assumes that bash will be the default shell of your web server.
demo.php runs “ls -alFh” but you can substitute any command