473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to auto start a service on rebooting a linux machine?

I am having one shell script as a service in my project.
It is auto starting in solaris but it is i don't know?

The same shell script, i migrated to Linux. It is working in normal senario, but i have to do some changes to auto restart on rebooting Linux machine.

My SOLARIS Environment:
SunOS csdev-sf240-1 5.10 Generic_137111-08 sun4u sparc SUNW,Sun-Fire-V240

My LINUX Environment:
Linux lms-sfx4140-pc1 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

ls /etc is below , please help with clear steps...,Thanks in advance..
Expand|Select|Wrap|Line Numbers
  1. a2ps.cfg               default               inittab.rpmorig   multipath_bindings        rc1.d              sudoers.16227
  2. a2ps-site.cfg          depmod.d              inputrc           multipath.conf            rc2.d              sudoers.19196
  3. acpi                   desktop-profiles      iproute2          multipath.conf.cisco      rc3.d              sudoers.19922
  4. adjtime                dev.d                 iscsi             multipath.conf.rpmorig    rc4.d              sudoers.22921
  5. aliases                dhcp6c.conf           issue             Muttrc                    rc5.d              sudoers.25288
  6. aliases.bak            DIR_COLORS            issue.net         Muttrc.local              rc6.d              sudoers.26292
  7. aliases.db             DIR_COLORS.xterm      issue.ssh         netplug                   rc.config.d        sudoers.28573
  8. alsa                   director.conf         java              netplug.d                 rc.d               sudoers.30137
  9. alternatives           dnsmasq.conf          jvm               NetworkManager            rc.local           sudoers.3182
  10. anacrontab             dnsmasq.d             jvm-commmon       nisp_domains              rc.sysinit         sudoers.6436
  11. asound.state           dumpdates             jwhois.conf       nscd.conf                 readahead.d        sudoers.9262
  12. at.deny                enscript.cfg          kde               nsswitch.conf             reader.conf        sudoers.9479
  13. audisp                 environment           kderc             nsswitch.conf.files       reader.conf.d      sudoers.9645
  14. audit                  esd.conf              kdump.conf        nsswitch.conf.nis         redhat-lsb         sysconfig
  15. auto.director          exports               kdump.conf.cisco  nsswitch.conf.nis-compat  redhat-release     sysctl.conf
  16. autofs_ldap_auth.conf  exports.mvfs          kdump_id_dsa      nsswitch.conf.nisplus     resolv.conf        syslog.conf
  17. auto.indirect          fb.modes              kdump_id_dsa.pub  nsswitch.conf.rpmorig     rmt                syslog_updater
  18. auto.indirect.m4       filesystems           krb5.conf         ntp                       rpc                system-profile
  19. auto.master            firmware              ksysguarddrc      ntp.conf                  rpm                system-profile.old
  20. auto.master.files      fonts                 ldap.conf         odbc.ini                  rwtab              system-profile.save
  21. auto.master.nis        foomatic              ld.so.cache       odbcinst.ini              rwtab.d            termcap
  22. auto.master.nisplus    fstab                 ld.so.conf        oddjob                    samba              udev
  23. auto.master.old        gconf                 ld.so.conf.d      oddjobd.conf              sane.d             updatedb.conf
  24. auto.master.rpmorig    gcrypt                lftp.conf         oddjobd.conf.d            sasl2              updatedb.conf.orig
  25. auto.misc              gdm                   libaudit.conf     openldap                  screenrc           vimrc
  26. auto.misc.cisco        ghostscript           libuser.conf      opt                       scrollkeeper.conf  vimrc.rpmsave
  27. auto.misc.rpmorig      gimp                  localtime         pam.d                     scsi_id.config     virc
  28. auto.net               gnome-vfs-2.0         login.defs        pam_pkcs11                securetty          warnquota.conf
  29. auto.smb               gnome-vfs-mime-magic  logrotate.conf    pam_smb.conf              security           wgetrc
  30. auto.ws                gpm-root.conf         logrotate.d       pango                     selinux            wpa_supplicant
  31. avahi                  gre.d                 lsb-release.d     passwd                    sensors.conf       X11
  32. bashrc                 group                 ltrace.conf       passwd-                   services           xdg
  33. blkid                  group-                lvm               pcmcia                    services.orig      xinetd.conf
  34. bluetooth              grub.conf             mail              pinforc                   sestatus.conf      xinetd.d
  35. bonobo-activation      gshadow               mailcap           pki                       setroubleshoot     xml
  36. cdrecord.conf          gssapi_mech.conf      mail.rc           pm                        setuptool.d        yp.conf
  37. cipe                   gtk-2.0               makedev.d         ppp                       sgml               yp.conf.prev
  38. conman.conf            hal                   man.config        prelink.cache             shadow             yum
  39. cron.d                 host.conf             maven             prelink.conf              shadow-            yum.conf
  40. cron.daily             hosts                 mgetty+sendfax    prelink.conf.d            shells             yum.repos.d
  41. cron.deny              hosts.allow           mime.types        printcap                  skel               zlogin
  42. cron.hourly            hosts.deny            minicom.users     profile                   slrn.rc            zlogout
  43. cron.monthly           hosts.orig            mke2fs.conf       profile.d                 smrsh              zprofile
  44. crontab                hp                    modprobe.conf     protocols                 snmp               zshenv
  45. cron.weekly            htdig                 modprobe.conf~    purple                    socks.conf         zshrc
  46. csh.cshrc              httpd                 modprobe.d        quotagrpadmins            sound
  47. csh.login              idmapd.conf           motd              quotatab                  ssh
  48. cups                   init.d                motd.BAK          racoon                    stunnel
  49. cvs-rpm                initlog.conf          mtab              rc                        sudoers
  50. dbus-1                 inittab               mtools.conf       rc0.d                     sudoers.13426

Thanks in Advance...
Mar 2 '11 #1
1 4221
sicarie
4,677 Expert Mod 4TB
I would recommend putting the script to kick off your 'service' in the /etc/rc.d files (some flavors it's rc0.d, rc1.d, others it's /etc/init.d/ . If you post a 'ls /etc' we can help you determine exactly which one it is).

You can either move your whole script there (not recommended) or create a script to kick off your script, such as below

#!/bin/bash
#script to start 'myscript' on boot

./usr/share/myscript

#end
and put that script in your init files in /etc/.

You'll need to make it executable by root (chmod +x <files>), and then inside those init files, the ones with a capitol S are 'startup' scripts, so the above file would need to be called something like S88myscript-start, and be put in the right place in the /etc/ folders (in my case I would put it in /etc/rc3.d) to make sure the other things your script calls are already loaded.
Mar 2 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: db2group88 | last post by:
How to auto start DB2 service on Linux Suse 9? we have db2 udb v8.2. I search the /etc/inittab file and don't find db:234:once:/etc/rc.db2 > /dev/console 2>&1 # Autostart DB2 Services so i...
2
by: Philip Wagenaar | last post by:
I have created a windows service and added a installer for the service. The service is set to autostart. After installation the service is listed in services as autostart. This is all fine, but I...
4
by: Ian | last post by:
Can anyone help I have a web server on the internet with and ASP.NET application on it, the application is set to allow Anonymous Access and Integrated Windows. The Web.config is set to use...
3
by: Eric Renken | last post by:
Does anyone know of a good auto update service. Using .NET 2.0 C#. I do not want to use InstallShields, even though that is who we use to create setups. There sales policies are starting to...
7
by: Raju5725 | last post by:
Hi All, How can I Change Local Machine IP Address without rebooting the machine using VB.Net. As I want to shift from one IP address to another IP address with application the effect should...
4
by: jgamble | last post by:
I'm working for the first time on an existing application that communicates with an SQL Server database. We've backed up the database and installed it on our own machine, and copied the ADB file...
1
by: rocket1356 | last post by:
Anyone know what component or where to get a tutorial on how to connect to a LINUX machine using a VB app? I am trying to create a WIN32 Visual Basic application that communicates with a LINUX...
5
by: nttuanit | last post by:
Hi All, I have a Web App, I want to start Main page automatically after IIS is started without any request from browser. OR run one Script in Global.asax after IIS started. I understand that...
7
by: sachinkale123 | last post by:
I want to stop Sql server Agent Windows service. I am using below code to stop or start the windows service. Which is I am doing sucessfully. ManagedComputer mc = default(ManagedComputer); ...
1
by: tvnaidu | last post by:
I have Linux machine and windows machine on same network, I want to keep Linux machine as CVS server and windows machine as CVS client, can I keep like that?. My development machine is windows...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.