2

I am trying to run a script at startup, for that i added a script in Init.d and created a link using command "update-rc.d script_name defaults" But when i restart the system i got only black screen. What can be the fault i am facing?

#!/bin/sh
#/etc/init.d/hello.sh
#
clear
echo "Hello $USER"
echo "Today is \c ";date
echo "Number of user login : \c" ; who | wc -l
echo "Calendar"
cal
2
  • What kind of script.. Can't it just crontab with @reboot
    – Ashish
    Feb 9, 2015 at 13:45
  • I didn't tried crontab yet but I am trying to print some text on display as my system start, I loaded script in init.d and created link as per above link but still something missing
    – AKASH
    Feb 9, 2015 at 13:50

1 Answer 1

0

As the SysV has been replaced by Upstart you should create a Upstart script for your task.

At first create a file in /etc/init/ directory, the filename must end in .conf. So, lets say the filename in your case is check_script.conf.

For your case the check_script.conf should have the following entries:

description  'Running script_name at startup'

start on runlevel [2345]
stop on runlevel [016]

script
    exec /full/path/to/script_name
end script
6
  • I tried your idea but still something missing
    – AKASH
    Feb 9, 2015 at 13:51
  • Please add the script you want to run to your original question..
    – heemayl
    Feb 9, 2015 at 14:29
  • i attach the script which i'm trying to run on startup
    – AKASH
    Feb 10, 2015 at 4:37
  • Should we have to mention only one run level ?
    – AKASH
    Feb 12, 2015 at 3:20
  • @AKASH: No, multiple is Ok.
    – heemayl
    Feb 12, 2015 at 3:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .