Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4485

Other programming languages • How to create at jobs from a website interface?

$
0
0
I have a few scripts (bash) to perform certain tasks depending on how they are called.
In order to make them execute at specific times I have another script that sets up the script executions via a command line call like this:

Code:

echo "cd <executiondir> ; <pathto>/scriptname arg1 arg2 arg3" | at <starttime>
where the placeholders are suitably filled in.
The echo + pipe into at is the only way I have found to actually code at process executions. But it works...

At the moment I do trhis on the command line using PuTTY from windows to access the RPi.
But it is pretty error prone because it is easy to mistype a command or argument so it screws up...

So I would like to use the apache webserver on the RPi to display a configuration page which I can use to easier select and schedule my scripts.
I am using php as the scripting language on my RPi devices with apache installed.

So how can I tell php to create the at jobs with the arguments entered on the web form?
In essence apache must issue the command line echo command as shown when I hit a web form button.
But I think there are blocks on what php can do from apache, but I don't know how that could be adjusted.

And I want to also see a list of the scheduled at jobs in the webpage as well.
I have written a script "atshow" on my RPi, which lists the jobs in sequential order in the terminal.
How can I make that be triggered from the webpage and the resulting data shown there?

Any suggestions on how to implement this with apache/php???

Statistics: Posted by Bosse_B — Sat Feb 10, 2024 11:15 pm — Replies 1 — Views 54



Viewing all articles
Browse latest Browse all 4485

Trending Articles