Linux init scripts with php

As seen on Edit the following file:

sudo vim /etc/init.d/local.autostart

Add this php script


// NOTE! Edit $path in the following line to a path 
$path ="/home/dennis/init_hello.log";
file_put_contents($path, "Hello World From init");


sudo chmod +x /etc/init.d/local.autostart
sudo update-rc.d local.autostart defaults 80

That is it. You got a auto start script.

Reboot and check the file /home/dennis/init.hello.log (or what ever you called the file) and look it and get you "Hello World"

This page has been viewed 3293 times. First hit: 01-Nov-2015 00:22:29
Share email, Google+, Twitter, Facebook.
comments powered by Disqus