Für das ckl-net bzw. meinem Webserver habe ich heute Abend ein kleines Admin-Script geschrieben, mit dem ich MPD und Icecast starten, stoppen und beenden kann.
Damit das Script funktioniert, muss man in der /etc/sudoers folgendes eintragen:

www-data ALL=NOPASSWD: /usr/local/bin/service-wrapper

Damit kann der Benutzer www-data ohne Passwort mit root-Rechten das Script /usr/local/bin/service-wrapper ausführen. service-wrapper an sich ist nur ein kleines Wrapper-Script zum Kotrollieren der Daemons:

#!/bin/sh
/etc/init.d/$1 $2

Das PHP-Script muss nun das Wrapper-Script aufrufen:

<?php
exec("/usr/local/bin/service-wrapper $servicename $status")

I am asking you for a donation.

You liked the content or this article has helped and reduced the amount of time you have struggled with this issue? Please donate a few bucks so I can keep going with solving challenges.


0 Comments

Leave a Reply