Im trying to create my own version of Ubuntu, and I want a command to run on first boot only. Is this possible?
Asked
Active
Viewed 748 times
1
$0
contains the execution path and the name of the script. So IMO you could addrm "$0"
at the end of the script. Here is an example: https://stackoverflow.com/a/192337/6543935 – pa4080 Jan 05 '18 at 19:05(this is the script I am trying to run at first boot)
– SorensenGaming Jan 05 '18 at 19:10/etc/rc.local
, as it is shown here: https://askubuntu.com/q/9853/566421 In this case you should add into the end of the script line as this:sed -i "/$0/d" /etc/rc.local && rm "$0"
. An other other way is to place your script in/etc/init.d/
and link it to/etc/rcX.d/
, whereX
is a certain runlevel: https://debian-administration.org/article/28/Making_scripts_run_at_boot_time_with_Debian – pa4080 Jan 05 '18 at 19:32