-1

I need to execute a shell script on an Ubuntu startup. I am using Ubuntu 14.04LTS version of Ubuntu.

I tried many things like rc.local, init.d etc. but I couldn't get it work.

This is the shell script that I want to execute:

#!/bin/sh

echo"Hello, World"
  • 2
    How did you verify it didn't work? Your above statement is missing a space between echo and ". Assuming it was correct on your system it would just do an echo statement which you wouldn't easily see. – Mikael Kjær Jan 2 '18 at 5:35
  • Should try at least a Google Search before asking askubuntu.com/a/48327/672379 – GypsyCosmonaut Jan 2 '18 at 8:23
2

Just to confirm, you copied your script into /etc/rc.local?

You can always use @reboot with cron. check this out : crontab manpage

0

Add the command to rc.local but make sure you specify the full path of the executable.

A simple echo can go unnoticed. Place a sleep afterward or redirect output to a file to be certain the command was executed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.