Professional Web Applications Themes

rc.subr startup question - FreeBSD

Hello, I'm running 5.3-STABLE and I want to write a startup script for ports/sysutils/mcron. The twis is, I want an mcron process for each user I specify in an external file. For example... /usr/local/etc/mcron.conf: $usernames="user1 user2 user3" /usr/local/etc/rc.d/mcron.sh #!/bin/sh # $Id$ # PROVIDE: mcron # REQUIRE: LOGIN # KEYWORD: FreeBSD shutdown # .. /etc/rc.subr name="mcron" prefix=/usr/local command=${prefix}/bin/${name} mcron_enable=${mcron_enable:-"NO"} mcron_flags=${mcron_flags-"-d"} # Load user names from conf file # .. ${prefix}/etc/${name}.conf rcvar=`set_rcvar` load_rc_config $name for user in ${usernames}; do mcron_user=${user} run_rc_command "$1" done This does not work because run_rc_command checks to see if the process is already running before attempting to launch ...

  1. #1

    Default rc.subr startup question

    Hello,

    I'm running 5.3-STABLE and I want to write a startup script for
    ports/sysutils/mcron. The twis is, I want an mcron process for
    each user I specify in an external file. For example...

    /usr/local/etc/mcron.conf:
    $usernames="user1 user2 user3"


    /usr/local/etc/rc.d/mcron.sh
    #!/bin/sh

    # $Id$

    # PROVIDE: mcron
    # REQUIRE: LOGIN
    # KEYWORD: FreeBSD shutdown
    #
    .. /etc/rc.subr

    name="mcron"
    prefix=/usr/local
    command=${prefix}/bin/${name}
    mcron_enable=${mcron_enable:-"NO"}
    mcron_flags=${mcron_flags-"-d"}


    # Load user names from conf file
    #
    .. ${prefix}/etc/${name}.conf

    rcvar=`set_rcvar`

    load_rc_config $name

    for user in ${usernames}; do

    mcron_user=${user}
    run_rc_command "$1"

    done


    This does not work because run_rc_command checks to see if the process
    is already running before attempting to launch another instance. I've
    read rc.subr(8) and it's not apparent if I can use the rc.subr tools in
    this scenario. Perhaps this is something best accomplished in
    /etc/rc.local? Any and all suggestions welcome.

    --
    Regards,
    Doug
    Doug Guest

  2. #2

    Default rc.subr startup question

    Hello,

    I'm running 5.3-STABLE and I want to write a startup script for
    ports/sysutils/mcron. The twis is, I want an mcron process for
    each user I specify in an external file. For example...

    /usr/local/etc/mcron.conf:
    $usernames="user1 user2 user3"


    /usr/local/etc/rc.d/mcron.sh
    #!/bin/sh

    # $Id$

    # PROVIDE: mcron
    # REQUIRE: LOGIN
    # KEYWORD: FreeBSD shutdown
    #
    .. /etc/rc.subr

    name="mcron"
    prefix=/usr/local
    command=${prefix}/bin/${name}
    mcron_enable=${mcron_enable:-"NO"}
    mcron_flags=${mcron_flags-"-d"}


    # Load user names from conf file
    #
    .. ${prefix}/etc/${name}.conf

    rcvar=`set_rcvar`

    load_rc_config $name

    for user in ${usernames}; do

    mcron_user=${user}
    run_rc_command "$1"

    done


    This does not work because run_rc_command checks to see if the process
    is already running before attempting to launch another instance. I've
    read rc.subr(8) and it's not apparent if I can use the rc.subr tools in
    this scenario. Perhaps this is something best accomplished in
    /etc/rc.local? Any and all suggestions welcome.

    --
    Regards,
    Doug
    Doug Guest

  3. #3

    Default Re: rc.subr startup question

    On 2005-03-14 15:56, Doug Poland <org> wrote: 
     

    Are you, by any chance, setting $pidfile to anything that is not shown
    above? The check_pidfile() check is disabled when $pidfile is empty.
     

    Probably.

    Giorgos Guest

  4. #4

    Default Re: rc.subr startup question

    On Tue, Mar 15, 2005 at 08:19:17AM +0200, Giorgos Keramidas wrote: [/ref]
    .... snip ... 
    >
    > Are you, by any chance, setting $pidfile to anything that is not shown
    > above? The check_pidfile() check is disabled when $pidfile is empty.
    >[/ref]
    no
     
    >
    > Probably.
    >[/ref]
    That's what I did. Not as elegant, but quick, easy, and it works.
    Thanks for your help.


    --
    Regards,
    Doug
    Doug Guest

Similar Threads

  1. More of an IIS / .asp startup question
    By warddc in forum Coldfusion - Getting Started
    Replies: 1
    Last Post: July 26th, 07:27 PM
  2. running startup scripts at server startup?
    By T in forum PHP Development
    Replies: 2
    Last Post: January 30th, 03:02 AM
  3. System Startup Script Question
    By Jeff Mulliken in forum AIX
    Replies: 10
    Last Post: October 16th, 01:01 PM
  4. Startup sound question.
    By Nathan in forum Windows XP/2000/ME
    Replies: 1
    Last Post: July 15th, 04:18 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139