Heisenberg - Digital Alchemist, Software Architect, Automation Specialist and Mechanical Engineer.
Labels
Friday, 26 March 2021
Monday, 22 March 2021
Trac on Slackware
Installation script for installing trac and it's dependencies on Slackware
Get it here: here
Note, you will need the rc.trac script, also from the above.
Thursday, 18 March 2021
Wednesday, 10 March 2021
Execute a shell command from php
To execute a shell command from php, typically do the following;
<?php
$output = shell_exec('sudo -u root monit summary');
echo "<pre>$output</pre>";
?>
In the above scenario, we want to run something as root, so we need to modify our /etc/sudoers file;
Firstly, assuming the user is www-data then we can add the following line to /etc/sudoers
www-data ALL = NOPASSWD: /usr/sbin/monit
where /usr/sbin/monit is the command that we wish to allow the user www-data to run without the need to enter a password.