Find the answer to your Linux question:
Results 1 to 3 of 3
Hello, i made a little script named FTPbackup that needs network connection to work, after many google searches i've hit a wall since i dont know what is the problem.(the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2012
    Posts
    2

    [F16] init script that requires network to run


    Hello, i made a little script named FTPbackup that needs network connection to work, after many google searches i've hit a wall since i dont know what is the problem.(the script works fine if i start it manually when network is on)

    Here is the chkconfig header
    Code:
    #!/bin/sh
    #
    # FTPBACKUP Mantiene una copia di una cartella su un FTP aggiornandola ad ogni boot
    #
    # chkconfig: 5 99 17
    # description: Simple FTP uploader
    #              
    
    ### BEGIN INIT INFO
    # Provides: FTPBACKUP
    # Required-Start: $network 
    # Required-Stop: 
    # Should-Start: $network
    # Should-Stop: 
    # Default-Start: 5
    # Default-Stop: 0 1 2 3 4 6
    # Short-Description: Boot time daemon
    # Description: enable service provided by daemon
    ### END INIT INFO
    and this is the error log as you can see the script says service not found because it runs just before the network connection.

    Code:
    Apr 25 16:40:02 Andromeda NetworkManager[879]: <info> (wlan0): supplicant interface state: starting -> ready
    Apr 25 16:40:02 Andromeda NetworkManager[879]: NetworkManager[879]: <info> (wlan0): supplicant interface state: starting -> ready
    Apr 25 16:40:02 Andromeda NetworkManager[879]: <info> (wlan0): device state change: unavailable -> disconnected (reason 'supplicant-available') [20 30 42]
    Apr 25 16:40:02 Andromeda NetworkManager[879]: NetworkManager[879]: <info> (wlan0): device state change: unavailable -> disconnected (reason 'supplicant-available') [20 30 42]
    Apr 25 16:40:02 Andromeda NetworkManager[879]: <info> (wlan0): supplicant interface state: ready -> inactive
    Apr 25 16:40:02 Andromeda NetworkManager[879]: NetworkManager[879]: <info> (wlan0): supplicant interface state: ready -> inactive
    Apr 25 16:40:02 Andromeda kernel: [   33.794353] iscsi: registered transport (iser)
    Apr 25 16:40:02 Andromeda kernel: [   33.828821] libcxgbi:libcxgbi_init_module: tag itt 0x1fff, 13 bits, age 0xf, 4 bits.
    Apr 25 16:40:02 Andromeda kernel: [   33.828833] libcxgbi:ddp_setup_host_page_size: system PAGE 4096, ddp idx 0.
    Apr 25 16:40:02 Andromeda kernel: [   33.831855] Chelsio T3 iSCSI Driver cxgb3i v2.0.0 (Jun. 2010)
    Apr 25 16:40:02 Andromeda kernel: [   33.833375] iscsi: registered transport (cxgb3i)
    Apr 25 16:40:02 Andromeda kernel: [   33.850599] Chelsio T4 iSCSI Driver cxgb4i v0.9.1 (Aug. 2010)
    Apr 25 16:40:02 Andromeda kernel: [   33.852107] iscsi: registered transport (cxgb4i)
    Apr 25 16:40:02 Andromeda kernel: [   33.871036] cnic: Broadcom NetXtreme II CNIC Driver cnic v2.5.8 (Jan 3, 2012)
    Apr 25 16:40:02 Andromeda kernel: [   33.879859] Broadcom NetXtreme II iSCSI Driver bnx2i v2.7.0.3 (Jun 15, 2011)
    Apr 25 16:40:02 Andromeda kernel: [   33.879988] iscsi: registered transport (bnx2i)
    Apr 25 16:40:02 Andromeda kernel: [   33.904081] iscsi: registered transport (be2iscsi)
    Apr 25 16:40:03 Andromeda iscsid: iSCSI logger with pid=1046 started!
    Apr 25 16:40:03 Andromeda iscsid[956]: Starting iscsid: [  OK  ]#015[  OK  ]
    Apr 25 16:40:03 Andromeda systemd[1]: PID file /var/run/iscsid.pid not readable (yet?) after start.
    Apr 25 16:40:03 Andromeda ftpbackup[980]: Starting FTPBACKUP: lftp: www 0catch com: Name or service not known
    Apr 25 16:40:03 Andromeda ftpbackup[980]: [FAILED]
    Apr 25 16:40:03 Andromeda systemd[1]: ftpbackup.service: control process exited, code=exited status=1
    Apr 25 16:40:03 Andromeda systemd[1]: Unit ftpbackup.service entered failed state.
    Apr 25 16:40:04 Andromeda iscsid: transport class version 2.0-870. iscsid version 2.0-872.15.f16
    Apr 25 16:40:04 Andromeda iscsid: iSCSI daemon with pid=1047 started!
    Apr 25 16:40:04 Andromeda NetworkManager[879]: <info> Auto-activating connection 'Alice-78409120'.
    Apr 25 16:40:04 Andromeda NetworkManager[879]: <info> Activation (wlan0) starting connection 'Alice-78409120'
    From what i understood in runlevel 5 i should already have network but i even put in required init info but as you can see it doesnt work,hope someone can shed a light on this,thanks

  2. #2
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    My advice is simple, remove NetworkManager and configure your network in /etc/sysconfig/network-scripts.
    Then ensure that the network is configured to start on boot;

    Code:
    chkconfig --level 345 network on
    you might find this page useful.
    Switch from Network Manager to Network Service &mdash; Fedora Unity Project

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  3. #3
    Just Joined!
    Join Date
    Apr 2012
    Posts
    2
    Quote Originally Posted by Lazydog View Post
    My advice is simple, remove NetworkManager and configure your network in /etc/sysconfig/network-scripts.
    Then ensure that the network is configured to start on boot;

    Code:
    chkconfig --level 345 network on
    you might find this page useful.
    Switch from Network Manager to Network Service — Fedora Unity Project
    Thanks for your suggestion but i followed an easier route, i put those lines in my script

    while ! ping -c1 www dotgoogledot com > /dev/null ;
    do
    sleep 5
    done
    |
    |
    |
    |rest of the script that needs network.
    |
    |



    In this way as you can see it checks for connection and continues only when a network is found and the pc is connected to it.

Posting Permissions

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