Link to home
Start Free TrialLog in
Avatar of yarekGmail
yarekGmail

asked on

Ubuntu linux : start script at starting

Hello experts
my question is really a very simple one
I need to start
/red5/red5.sh
when the server starts

What I did is:
I created a myscript using VI (it created some start(), stop() functions)
in
/etc/init.d

Is this ALL I have to do or did I miss something ?

#!/sbin/runscript
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

depend() {

}

start() {
/red5/red5.sh&
}

stop() {

}

restart() {

}

Open in new window

Avatar of vikas_madhusudana
vikas_madhusudana
Flag of India image

Avatar of Fabio Marzocca
just add your script to /etc/rc.local
Avatar of yarekGmail
yarekGmail

ASKER

1) I use SSH no graphic desktop
2) I ran:
# update-rc.d red5 defaults
-bash: update-rc.d: command not found
and there is no

/etc/rc.local

on my ubuntu !

you should have /etc/rc.local  it is in all ubuntu server/desktop default installations
cd /etc/rc.local
-bash: cd: /etc/rc.local: Aucun fichier ou répertoire de ce type

Which means : No files or directory with such name !

One cagain I do not have a DESKTOP ubuntu , only SSH
NO!

sudo gedit /etc/rc.local
or, if you have a server,

sudo nano /etc/rc.local

If you don't have update-rc.d or /etc/local, try to link your script in /etc/rcX.d/, where X is init level.
etc # cd /etc
etc # ls rc*
rc.conf

THERE IS NO rc* in  /etc/  !!!
c'mon....

ls /etc | grep rc.local


# ls /etc | grep rc.local
#

NOTHING !


Mybe this can help:

# cat /proc/version
Linux version 2.6.31.5-grsec-xxxx-grs-ipv4-64 (root@kernel-64.ovh.net) (gcc version 4.3.2 (Debian 4.3.2-1.1) ) #2 SMP Thu Nov 5 12:36:20 UTC 2009
/ # uname -a

Linux ns22372.ovh.net 2.6.31.5-grsec-xxxx-grs-ipv4-64 #2 SMP Thu Nov 5 12:36:20 UTC 2009 x86_64 Intel(R) Xeon(R) CPU W3520 @ 2.67GHz GenuineIntel GNU/Linux

I just wonder why it is so complex to run a script at runtime... Really hate linux for that !

Who said it is difficult? I am running scripts at runtime since 7 years ...
What version of ubuntu? You did not mention it and right now ubuntu is heavily working on the startup.
What does
cat /etc/lsb-release say?
well (to fmazocca) yes it is difficult ! Since we cannot do it !
cat /etc/lsb-release : error : No such file !

Here is the complete /etc listing !
etc # ls
adjtime                  crontab             fdprm           init.d             login.access       mke2fs.conf         nsswitch.conf   quotatab        skel           warnquota.conf
bash                     crontab.merged      filesystems     inittab            login.defs         modprobe.devfs      openldap        rc.conf         spamassassin   watchdog.conf
bind                     cron.weekly         freshclam.conf  inputrc            logrotate.conf     modprobe.devfs.old  opt             resolv.conf     ssh            webalizer.conf.hello
ca-certificates.conf     csh.env             fstab           iproute2           logrotate.d        modules.autoload.d  ovhm.db         rmt             ssl            webalizer.conf.sample
clamd.conf               default             ftpusers        issue              lynx.cfg           modules.conf        ovhrelease      rpc             sudoers        webmin
clamd.conf.bak.patchovh  dev.d               gensync         issue.logo         lynx.lss           modules.conf.old    pam.d           rsyncd.conf     sysctl.conf    wget
collectd.conf            devfs.d             gentoo-release  kdc.conf.example   mail               modules.d           passwd          runlevels       syslog-ng      xinetd.d
conf.d                   devfsd.conf         gpm             krb5.conf.example  mailcap            modules.devfs       passwd-         screenrc        t1lib          xml
courier                  DIR_COLORS          group           ld.so.cache        mail.rc            motd                portage         scsi_id.config  tcp.smtp
courier-imap             dispatch-conf.conf  group-          ld.so.conf         make.conf          mots                profile         securetty       tcp.smtp.cdb
cron.d                   env.d               host.conf       lilo.conf          make.conf.example  mtab                profile.env     security        terminfo
cron.daily               environment         hosts           lilo.conf.example  make.globals       mysql               proftpd         services        udev
cron.deny                eselect             hosts.bck       limits             make.profile       nanorc              protocols       shadow          updatedb.conf
cron.hourly              etc-update.conf     hotplug.d       locales.build      man.conf           networks            pwdb.conf       shadow-         vim
cron.monthly             exports             httpd           localtime          mime.types         nscd.conf           quotagrpadmins  shells          vpopmail

Open in new window

You have a VERY uncommon installation of ubuntu. No rc.local, no lsb-release. That's not standard and that's why you're having troubles.
i.e.: gentoo-release is NOT ubuntu!
lilo is not a standard ubuntu bootloader
your cat /proc/version doesn't even mention Ubuntu.

Are you sure you are running ubuntu??
Who set this system up? It's not standard ubuntu (neither desktop nor server)! Don't blame linux for it.
What is
cat /etc/motd
? (at least that file exists ...)
sorry fmazzocca
I was said it was ubunta and I think that you are right since there is Gentoo files inside /etc

So I think it is Gentoo
What is
cat /etc/gentoo-release
?
this is not a Gentoo board.
cat /etc/gentoo-release
Gentoo Base System version 1.6.14
Now that we're sure about your linux flavor:

add whatever you want to start to the bottom of

/etc/conf.d/local.start

That file should exist.

Please check the output of the command line

rc-update -s default

It should have an entry for local.
the script will accept 3 grades, calculate an average and display a letter grade based upon the average. You will need to use either the if statement and/or the case statement to implement this script. I will verify that each pseudo step is addressed by executing your script/program.
ASKER CERTIFIED SOLUTION
Avatar of PhobiaDHS
PhobiaDHS

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial