automatic startup shell script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shahjapan
    New Member
    • Apr 2007
    • 63

    #1

    automatic startup shell script

    Hello,

    I want to start a server at the linux system boot up (UBUNTU 7.04 )

    I have used start-stop-daemon command in my shell script for that.

    I have written my shell script path in /etc/rc.local file.

    its working.


    but I want to add the parameters of my program like port no of my application.

    but I dont know how to pass the parameters to the application when using it with start-stop-daemon command.
    Last edited by shahjapan; Jul 6 '07, 10:19 AM. Reason: code used mistakely
  • prn
    Recognized Expert Contributor
    • Apr 2007
    • 254

    #2
    Hi shahjapan,

    Basically, this is all going to depend on how you pass parameters to the daemon when you start it manually. Check that out, then look at the script in rc.local and modify whatever needs modifying. Knowing nothing more than you have told us, I can't really anwwer in any more detail, but that's basically what I would do in any case.

    HTH,
    Paul

    Comment

    • shahjapan
      New Member
      • Apr 2007
      • 63

      #3
      Originally posted by prn
      Hi shahjapan,

      Basically, this is all going to depend on how you pass parameters to the daemon when you start it manually. Check that out, then look at the script in rc.local and modify whatever needs modifying. Knowing nothing more than you have told us, I can't really anwwer in any more detail, but that's basically what I would do in any case.

      HTH,
      Paul
      for example you can take postgreSQL server with port no if wetry it using start-stop-daemon command then how to pass the parameters with the following command.....

      start-stop-daemon postgresql -p 5431 start

      Comment

      • prn
        Recognized Expert Contributor
        • Apr 2007
        • 254

        #4
        Hi shahjapan,

        Sorry I hadn't got back to you. I've been sick for the last couple of days and not looking at this forum. :(

        I think we're talking about several different things here.

        I don't have an Ubuntu (or other Debian) system here to comment on, but I can describe how things work on some other kinds of system and you may be able to adapt from that.

        On any unix-like system, there are a lot of daemons, so we need to be careful about which one we are talking about at any given time.

        What you are apparently trying to do is to start your postgreSQL (daemon/server) and pass it a port number as you do, correct?

        In order to do this, you have written a script and placed it in rc.local. Have you looked at the other scripts in rc.local? My guess is that this is the first and only script in rc.local, so you should look at other scripts in rc*.d to see how they work.

        What I suspect you will find is the start-stop-daemon is NOT invoked from those scripts. Rather those scripts are what start-stop-daemon runs, at least that is how the equivalent works on other systems (e.g., Fedora, Solaris, etc.). That is, the startup procedure goes through the appropriate rc directories and runs the various startup scripts that it finds there. THOSE scripts set the parameters for the various servers (daemons) that are started this way. (Often by starting the servers using a config file.)

        For example, a typical startup script, such as /etc/rc.d/rc3.d/K36mysqld (which is actually a symlink to /etc/rc.d/init.d/mysqld) will then check the command line by which it was called, determine from that whether it was supposed to start, stop, restart, etc. and then do the right thing. If it is supposed to start the mysql server, it points the server to the appropriate configuration file. In other cases, the server daemons are started by passing them parameters directly.

        Pick a script among your init scripts and see how parameters are passed to the servers in them.

        HTH,
        Paul

        Comment

        Working...