General NAS-Central Forums

Welcome to the NAS community
It is currently Wed Dec 13, 2017 2:45 pm

All times are UTC




Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Wed Nov 26, 2014 11:51 pm 
Offline

Joined: Sun Mar 20, 2011 3:44 pm
Posts: 47
Here are my initng scripts:

portmap.i:
Code:
#!/sbin/itype

daemon portmap {
   need = samba/smbd bootmisc virtual/net;
   require_network;
   exec daemon = /opt/sbin/portmap_daemon;
   pid_file = /var/run/portmap.pid;
   
}


unfsd.i:
Code:
#!/sbin/itype

daemon unfsd {
   require_network;
   need = portmap bootmisc virtual/net;
   exec daemon = /opt/sbin/unfsd_daemon;
        pid_file = /var/run/unfsd.pid;
                       
}


Both are in /etc/ining and they are in the /etc/initng/runlevel.default.runlevel

The sripts that the initng files run are in /opt/sbin/:
/opt/sbin/portmap_daemon:
Code:
#!/bin/sh

/opt/sbin/portmap &
echo $$ > /var/run/portmap.pid

while [ 1 -eq 1 ]
do
   sleep 100000
done


exit 0



/opt/sbin/unfsd_daemon:
Code:
#!/bin/sh

/opt/sbin/unfsd -e /opt/sbin/exports

echo $$ > /var/run/unfsd.pid

while [ 1 -eq 1 ]
do
   sleep 100000
done


exit 0


The file export is in /etc/export and in /opt/sbin/export
Code:
/shares/nfsshare/ (rw,no_root_squash)
/shares/www/ (rw,no_root_squash)
/shares/OpenShare/Downloads/ (rw,no_root_squash)


If I reboot the processare started:
ps after reboot
Code:
[root@Metronome sbin]# ps
  PID USER       VSZ STAT COMMAND
    1 root      3188 S    initng [runlevel/default]
    2 root         0 SW<  [kthreadd]
    3 root         0 SWN  [ksoftirqd/0]
    4 root         0 SW<  [events/0]
    5 root         0 SW<  [khelper]
   34 root         0 SW<  [kblockd/0]
   56 root         0 SW<  [input-watchdog]
   68 root         0 SW   [pdflush]
   69 root         0 SW   [pdflush]
   70 root         0 SW<  [kswapd0]
   71 root         0 SW<  [aio/0]
   72 root         0 SW<  [unionfs_siod/0]
  189 root         0 SW<  [scsi_eh_0]
  190 root         0 SW<  [scsi_eh_1]
  208 root         0 SW<  [mtdblockd]
  220 root         0 SW<  [kondemand/0]
  315 root         0 SW<  [kjournald]
  436 root         0 SW<  [kjournald]
  439 root         0 SW<  [kjournald]
  509 root      2988 S    watch -n3600 date >> /var/log/test_mem.log;python /us
  510 root      2988 S    watch -n3600 date >> /var/log/ps_mem.log; ps >> /var/
  557 root      1740 S <  /sbin/udevd --daemon
  562 root         0 SW<  [xfslogd/0]
  568 root         0 SW<  [xfsdatad/0]
  580 root         0 SW<  [khubd]
  778 root      2988 S    /sbin/getty 115200 ttyS0
  834 root      1688 S    /usr/sbin/syslogd -n -m 0
  836 root     15544 S    /usr/sbin/smbd -F
  837 root      2596 S    /usr/sbin/klogd -n -c 1
  838 root      1688 S    /usr/sbin/cron
  839 messageb  2596 S    /usr/bin/dbus-daemon --system --fork
  840 root      5812 S    /usr/sbin/hald --daemon=no --retain-privileges
  845 root      1908 S    /sbin/dhcdbd --system
  846 root      4104 S    hald-runner
  851 root      4200 S    hald-addon-input: Listening on /dev/input/event0
  852 root      4196 S    /usr/libexec/hald-addon-leds
  857 root     13980 S    /usr/sbin/NetworkManager
  858 root      4344 S    /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
  860 root      130m S    /usr/bin/python -OO /usr/lib/unicorn/run.py -c /etc/u
  861 root     11424 S N  /usr/sbin/thumbd
  867 root     10016 S    /usr/bin/php-cgi
  868 root      4136 S    /usr/sbin/sshd
  872 root      4212 S    /usr/libexec/hald-addon-cpufreq
  873 root     10016 S    /usr/bin/php-cgi
  874 root     10016 S    /usr/bin/php-cgi
[b]  900 root      2340 S    /bin/sh /opt/sbin/portmap_daemon [/b]
[b]  902 root      2852 S    sleep 100000 [/b]
  903 bin       1596 S    /opt/sbin/portmap
[b]  904 root      2344 S    /bin/sh /opt/sbin/unfsd_daemon [/b]
  927 root      1848 S    /usr/sbin/ntpd -sd
  928 root      1692 S    /usr/sbin/ntpd -sd
  929 root      6748 S    sshd: root@ttyp1 
  934 root      5824 S    /usr/sbin/fan_controller --config-dir=/etc/fan_contro
[b]  947 root      6720 S    /opt/sbin/unfsd -e /opt/sbin/exports [/b]
[b]  948 root      2852 S    sleep 100000 [/b]
  956 avahi     2928 S    avahi-daemon: running [Metronome.local]
  957 root      6748 S    sshd: root@ttyp0 
  963 root         0 SW<  [xfsbufd]
  964 root      2564 S    -sh
  965 root         0 SW<  [xfssyncd]
  972 root      4184 S    /sbin/ipcommd
  980 root      3444 S    /usr/sbin/cupsd -F
  987 root         0 SW<  [loop1]
  989 root      2556 S    -sh
 1024 root      9016 S    /usr/sbin/nmbd -F
 1026 root     11940 S    /usr/sbin/winbindd -F
 1027 root     12016 S    /usr/sbin/winbindd -F
 1031 root      1828 S    /usr/sbin/cnid_metad -P /var/run/cnid_metad.pid
 1040 root      1928 S    /usr/sbin/atalkd -P /var/run/atalkd.pid
 1042 root      5440 S    /usr/sbin/afpd -P /var/run/afpd.pid -g nobody -c 25 -
 1047 root      1716 S    /usr/local/twonkymedia/twonkymedia -inifile /usr/loca
 1048 root      7000 S    /usr/local/twonkymedia/twonkymediaserver -inifile /us
 1053 root     20456 S    /usr/sbin/mt-daapd -d 0 -m -c /etc/mt-daapd.conf
 1068 root      9600 S    proftpd: (accepting connections)
 1072 root     34868 S    /usr/bin/python -OO /usr/lib/unicorn/run.py -c /etc/u
 1255 root      3060 R    ps


If after a reboot I execute the following command in the client I get:
Code:
root@tuner:/mnt/metronome# showmount -e metronome
Export list for metronome:


If I kill the unsfd program in the server and startit manualy I get:
Code:
root@tuner:/mnt/metronome# showmount -e metronome
Export list for metronome:
/shares/nfsshare/            <anon clnt>
/shares/www/                 <anon clnt>
/shares/OpenShare/Downloads/ <anon clnt>


What Ia am doing wrong tha it is cousing that in boot I cannot connect? But If I run it manualy I can?


Top
 Profile  
 
PostPosted: Thu Nov 27, 2014 12:29 am 
Offline

Joined: Sun Mar 20, 2011 3:44 pm
Posts: 47
I think the problem is that the shares that I have in the exports file are all in /shares/
An it is possible that the path /shares/ is not ready when the program starts.

How can I guarantee that teh program only starts after the /shares/ is ready?


Top
 Profile  
 
PostPosted: Thu Nov 27, 2014 2:38 pm 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 6088
Code:
#!/bin/sh

echo $$ > /var/run/unfsd.pid

while [ 1 -eq 1 ]
do
    if cat /proc/mounts | grep /shares
    then
        break
    fi
done

/opt/sbin/unfsd -e /opt/sbin/exports

while [ 1 -eq 1 ]
do
   sleep 100000
done

exit 0


Top
 Profile  
 
PostPosted: Wed Dec 03, 2014 12:06 pm 
Offline

Joined: Fri Sep 16, 2011 6:18 am
Posts: 39
I would myself be a little bit hesitant to run a while loop without a sleep in it.

Code:
# A while loop that will repeat until nfsshare is mounted
while true
do
      # If mounted, break out of the while loop
      mountpoint -q /shares/nfsshare && break
      # Put in a sleep to create a small pause between each attempt
      sleep 5
done


Top
 Profile  
 
PostPosted: Wed Dec 03, 2014 6:48 pm 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 6088
Good point.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group