Be Excellent To Each Other

And, you know, party on. Dude.

All times are UTC [ DST ]




Reply to topic  [ 52 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Unix Spods
PostPosted: Thu Aug 07, 2008 13:30 
User avatar
making out to faces of death

Joined: 1st Apr, 2008
Posts: 2686
Location: Sadville
I'm sure there are a good handful of unix knowledgable peeps here. What I need to know (because I forgot the one time I found it) is how to run something from an SSH terminal that keeps running after I log out/close the terminal. It's some extra word or symbols in the command.

I haven't found a way that works yet. :nerd:

_________________
Me flickr
Image


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 13:43 
User avatar

Joined: 30th Mar, 2008
Posts: 32624
AceAceBaby wrote:
I'm sure there are a good handful of unix knowledgable peeps here. What I need to know (because I forgot the one time I found it) is how to run something from an SSH terminal that keeps running after I log out/close the terminal. It's some extra word or symbols in the command.

I haven't found a way that works yet. :nerd:


Put an '&' character after the command. Umm, I think. Been years since I had to do this because I always use screen now.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 13:52 
User avatar
I forgot about this - how vain

Joined: 30th Mar, 2008
Posts: 5979
An '&' after a command allows you to continue to use the terminal (i.e 'emacs Readme.txt &') would open emacs in a seperate window but allow you to continue typing in the terminal.

If you want to be able to ssh into a seperate machine (PC B), set something running and then close the terminal and be able to turn off your machine (PC A) then you want to use 'screen'

Just:
1) ssh from your machine (PC B) to the machine you want to use (PC A).
2) Type 'screen'
3) Press space
4) Then set a program running e.g. 'top' 'main' or whatever you want,
5) Click the cross to close your terminal window.
6) Turn off your machine (PC B)
7) Set fire to your PC B
8) Buy a new machine (PC C)
9) ssh back into PC A with your new machine
10) Type 'screen -r'
11) Tada! It's been running top or main or whatever this whole time, and you can carry on where you left off.

There are other great commands in screen to.
ctrl-a-c creates a new terminal session

ctrl-a-n
ctrl-a-p both go to the next or previous terminal

(That will make sense when you try it).

_________________
Curiosity wrote:
The Rev Owen wrote:
Is there a way to summon lave?

Faith schools, scientologists and 2-D platform games.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 13:55 
User avatar
making out to faces of death

Joined: 1st Apr, 2008
Posts: 2686
Location: Sadville
I am using Putty to talk to my NAS, so it doesn't have screens and things like that. I knew about the & thing, and I had tried some "nohup" thing that probably was irrelevant.

Thanks so far for suggesting things though.

_________________
Me flickr
Image


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 13:57 
User avatar
Heavy Metal Tough Guy

Joined: 31st Mar, 2008
Posts: 6634
Yeah, a '&' at the end should do it.

But screen is probably a good idea, just it make it easier to log any output or kill it if it goes crazy.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 13:59 
User avatar
I forgot about this - how vain

Joined: 30th Mar, 2008
Posts: 5979
AceAceBaby wrote:
I am using Putty to talk to my NAS, so it doesn't have screens and things like that. I knew about the & thing, and I had tried some "nohup" thing that probably was irrelevant.

Thanks so far for suggesting things though.


I don't know what a NAS is. But Putty doesn't need to have screen, screen is a local program that runs on the unix machine itself. Almost all unix machines have screen installed. It's basically an independent terminal that allows people to connect, disconnect and reconnect to it.

_________________
Curiosity wrote:
The Rev Owen wrote:
Is there a way to summon lave?

Faith schools, scientologists and 2-D platform games.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 13:59 
User avatar

Joined: 30th Mar, 2008
Posts: 32624
Lave wrote:
10) Type 'screen -r'
'screen -D -R' is preferable, particularly if you are logging into a remote server which may or may not have been rebooted since you last went there and may or may not still have a running screen.

Aha, yes, 'nohup' is what you want. With & as well IIRC. You're quite right that your NAS is unlikely to have screen on it.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 14:06 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69809
Location: Your Mum
I'm a fan of setting it running, pressing CTRL-Z, then typing bg.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 14:23 
User avatar
making out to faces of death

Joined: 1st Apr, 2008
Posts: 2686
Location: Sadville
It's a Western Digital MyBook World Edition, and I'm trying to run ushare. There are instructions for running this from startup, but they didn't work/I didn't do them right (choose accordingly) so instead I just want to run putty on my laptop, SSH to the little WD NAS, log in as root and run the proggy.

"nohup ushare -(options blah) &" doesn't work. It stops running when I close putty.

_________________
Me flickr
Image


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 14:29 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69809
Location: Your Mum
AceAceBaby wrote:
It stops running when I close putty.

Ahem!
Grim... wrote:
I'm a fan of setting it running, pressing CTRL-Z, then typing bg.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 14:30 
User avatar
Song Wars 08/09 Champion

Joined: 30th Mar, 2008
Posts: 2320
Try

setsid /path/to/ushare -options

you might need to fiddle with the options syntax, it can be a bit of an arse. I always manage to get it wrong the first time.

(nb. it's a slightly newer command I think, it might not actually be "installed")

_________________
Image


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 14:55 
User avatar
making out to faces of death

Joined: 1st Apr, 2008
Posts: 2686
Location: Sadville
Grim... wrote:
I'm a fan of setting it running, pressing CTRL-Z, then typing bg.


ctrl-z doesn't do anything. :(

_________________
Me flickr
Image


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 14:57 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69809
Location: Your Mum
:S
Huh. Okay.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 15:03 
User avatar
making out to faces of death

Joined: 1st Apr, 2008
Posts: 2686
Location: Sadville
Sheepeh wrote:
Try

setsid


Command not found. :( It's not like some all singing n dancing linux, it's some bare bones stuff that keeps the NAS running.

_________________
Me flickr
Image


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 15:33 
User avatar
Sitting balls-back folder

Joined: 30th Mar, 2008
Posts: 10206
Code:
ushare >/dev/null 2>/dev/null </dev/null &
That's the command my startup-script for my script that auto-restarts* uShare uses.

* uShare doesn't notice if you change the stuff in the directory it shares, so you have to poke the built-in web server or restart it. I check for changes in the disk-free value.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 15:37 
User avatar
Song Wars 08/09 Champion

Joined: 30th Mar, 2008
Posts: 2320
I'm not sure.

In my experience

nohup ushare &

should have worked for you.

_________________
Image


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 15:38 
User avatar
Sitting balls-back folder

Joined: 30th Mar, 2008
Posts: 10206
The built-in environment of my Dlink doesn't have nohup either, they chose not to build it into busybox.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 15:44 
User avatar
making out to faces of death

Joined: 1st Apr, 2008
Posts: 2686
Location: Sadville
BikNorton wrote:
Code:
ushare >/dev/null 2>/dev/null </dev/null &
That's the command my startup-script for my script that auto-restarts* uShare uses.

* uShare doesn't notice if you change the stuff in the directory it shares, so you have to poke the built-in web server or restart it. I check for changes in the disk-free value.


My xbox360 lost connection to the ushare again when I closed putty after using that command. I wonder if the problem is putty sending some kind of kill all processes command?

_________________
Me flickr
Image


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 15:52 
User avatar
Sitting balls-back folder

Joined: 30th Mar, 2008
Posts: 10206
PuTTY doesn't do that, I used to leave stuff running on PC-based Linuxes just using the trailing &. Weird problem you've got there.

Actually, if you're using a proper script, uShare should be doing a proper session disconnect and running as a proper daemon; if you type 'ps aux', do the uShare commands have '-D' in them?


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 16:13 
User avatar
making out to faces of death

Joined: 1st Apr, 2008
Posts: 2686
Location: Sadville
This is what is currently in there, with stuff working and me watching an avi on the eggbox

Code:
[root@MyBookWorld src]# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  1.2   1292   372 ?        Ss   05:35   0:00 init
root         2  0.0  0.0      0     0 ?        SN   05:35   0:03 [ksoftirqd/0]
root         3  0.0  0.0      0     0 ?        S<   05:35   0:00 [events/0]
root         4  0.0  0.0      0     0 ?        S<   05:35   0:00 [khelper]
root         5  0.0  0.0      0     0 ?        S<   05:35   0:00 [kthread]
root         9  0.0  0.0      0     0 ?        S<   05:35   0:00 [kblockd/0]
root        36  0.0  0.0      0     0 ?        S    05:35   0:00 [pdflush]
root        37  0.0  0.0      0     0 ?        S    05:35   0:00 [pdflush]
root        38  0.0  0.0      0     0 ?        S    05:35   0:01 [kswapd0]
root        39  0.0  0.0      0     0 ?        S<   05:35   0:00 [aio/0]
root       143  0.0  0.0      0     0 ?        S<   05:35   0:06 [ata/0]
root       146  0.0  0.0      0     0 ?        S<   05:35   0:00 [sata-endQ]
root       147  0.0  0.0      0     0 ?        S<   05:35   0:00 [scsi_eh_0]
root       152  0.0  0.0      0     0 ?        S<   05:35   0:01 [sata-endQ]
root       153  0.0  0.0      0     0 ?        S<   05:35   0:00 [scsi_eh_1]
root       164  0.0  0.0      0     0 ?        S<   05:35   0:00 [kcryptd/0]
root       165  0.0  0.0      0     0 ?        S<   05:35   0:00 [kcryptd/0]
root       168  0.0  0.0      0     0 ?        S<   05:35   0:00 [md4_raid1]
root       170  0.0  0.0      0     0 ?        S<   05:35   0:00 [md3_raid1]
root       172  0.0  0.0      0     0 ?        S<   05:35   0:00 [md2_raid1]
root       174  0.0  0.0      0     0 ?        S<   05:35   0:00 [md1_raid1]
root       175  0.0  0.0      0     0 ?        S<   05:35   0:00 [kjournald]
root       183  0.0  0.0      0     0 ?        S<   05:35   0:00 [kjournald]
root       185  0.0  0.0      0     0 ?        S<   05:35   0:00 [kjournald]
root       230  0.0  2.2   2144   684 ?        S    05:35   0:18 /usr/sbin/sshd
root       489  0.0  0.0      0     0 ?        S<   05:35   0:00 [khubd]
root       671  0.0  2.7   1540   816 ?        S    05:35   0:00 /bin/bash /usr/
root       683  0.0  0.8    560   244 ?        S    05:35   0:01 /usr/local/wdc/
root       705  0.0  0.6    552   188 ?        S    05:35   0:00 /sbin/keyring
root       764  0.0  4.7   1520  1432 ?        SL   05:36   0:00 /usr/sbin/ntpd
root       768  0.0  1.0   1296   316 ?        S    05:36   0:00 /usr/sbin/inetd
root       772  0.0  1.1    740   348 ?        S    05:36   0:00 /sbin/mDNSRespo
root       775  0.0  2.4   1948   748 ?        Ss   05:36   0:00 /usr/local/samb
www-data   779  0.0  2.8   2700   852 ?        S    05:36   0:00 /usr/sbin/light
www-data   783  0.0 31.0  12056  9312 ?        S    05:36   0:15 perl /usr/www/l
root       796  0.0  1.0   1288   324 ?        S    05:36   0:00 /usr/sbin/crond
root       800  0.0  0.8   1288   248 ?        S    05:36   0:00 udhcpc -n -p /v
root       809  0.0  1.1   1288   356 ttyS0    Ss+  05:36   0:00 /sbin/getty -L
root       810  0.0  1.2   1284   372 ?        Ss   05:36   0:00 /sbin/syslogd -
root       811  0.0  1.2   1284   368 ?        Ss   05:36   0:00 /sbin/klogd -n
root       812  0.0  0.4   1300   144 ?        S    05:36   0:00 /bin/httpd -p 8
root      2000  0.0  3.9   4736  1188 ?        Ss   15:45   0:00 /usr/sbin/sshd:
1002      2009  0.2  2.7   4772   828 ?        S    15:47   0:04 /usr/sbin/sshd:
1002      2010  0.0  3.3   1880  1004 pts/0    Ss+  15:47   0:00 -sh
root      2015  0.1  3.5   1604  1072 pts/0    S+   15:48   0:01 -bash
root      2024  0.2  7.2   2616  2184 pts/0    S+   15:49   0:03 ushare -x
root      2025  0.0  7.2   2616  2184 pts/0    S+   15:49   0:00 ushare -x
root      2026  0.0  7.2   2616  2184 pts/0    S+   15:49   0:00 ushare -x
root      2027  0.0  7.2   2616  2184 pts/0    S+   15:49   0:00 ushare -x
root      2030  1.1  7.2   2616  2184 pts/0    S+   15:49   0:16 ushare -x
root      2031  0.0  7.2   2616  2184 pts/0    S+   15:49   0:00 ushare -x
root      2032  0.0  7.2   2616  2184 pts/0    S+   15:49   0:00 ushare -x
root      2094  0.0  0.7    564   220 ?        S    16:12   0:00 sleep 300
root      2152  0.0  1.3   1400   412 pts/0    R+   16:12   0:00 ps aux
[root@MyBookWorld src]#

_________________
Me flickr
Image


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 17:46 
Excellent Member

Joined: 14th Jul, 2008
Posts: 60
use "ps auxww" to get the full command, rather than the chopped off version.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 17:53 
User avatar
making out to faces of death

Joined: 1st Apr, 2008
Posts: 2686
Location: Sadville
Code:
[root@MyBookWorld src]# ps -auxww
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  1.2   1292   372 ?        Ss   05:35   0:00 init
root         2  0.0  0.0      0     0 ?        RN   05:35   0:03 [ksoftirqd/0]
root         3  0.0  0.0      0     0 ?        S<   05:35   0:00 [events/0]
root         4  0.0  0.0      0     0 ?        S<   05:35   0:00 [khelper]
root         5  0.0  0.0      0     0 ?        S<   05:35   0:00 [kthread]
root         9  0.0  0.0      0     0 ?        S<   05:35   0:00 [kblockd/0]
root        36  0.0  0.0      0     0 ?        S    05:35   0:00 [pdflush]
root        37  0.0  0.0      0     0 ?        S    05:35   0:00 [pdflush]
root        38  0.0  0.0      0     0 ?        S    05:35   0:01 [kswapd0]
root        39  0.0  0.0      0     0 ?        S<   05:35   0:00 [aio/0]
root       143  0.0  0.0      0     0 ?        S<   05:35   0:07 [ata/0]
root       146  0.0  0.0      0     0 ?        S<   05:35   0:00 [sata-endQ]
root       147  0.0  0.0      0     0 ?        S<   05:35   0:00 [scsi_eh_0]
root       152  0.0  0.0      0     0 ?        S<   05:35   0:01 [sata-endQ]
root       153  0.0  0.0      0     0 ?        S<   05:35   0:00 [scsi_eh_1]
root       164  0.0  0.0      0     0 ?        S<   05:35   0:00 [kcryptd/0]
root       165  0.0  0.0      0     0 ?        S<   05:35   0:00 [kcryptd/0]
root       168  0.0  0.0      0     0 ?        S<   05:35   0:00 [md4_raid1]
root       170  0.0  0.0      0     0 ?        S<   05:35   0:00 [md3_raid1]
root       172  0.0  0.0      0     0 ?        S<   05:35   0:00 [md2_raid1]
root       174  0.0  0.0      0     0 ?        S<   05:35   0:00 [md1_raid1]
root       175  0.0  0.0      0     0 ?        S<   05:35   0:00 [kjournald]
root       183  0.0  0.0      0     0 ?        S<   05:35   0:00 [kjournald]
root       185  0.0  0.0      0     0 ?        S<   05:35   0:00 [kjournald]
root       230  0.0  2.2   2144   684 ?        S    05:35   0:18 /usr/sbin/sshd
root       489  0.0  0.0      0     0 ?        S<   05:35   0:00 [khubd]
root       671  0.0  2.7   1540   816 ?        S    05:35   0:00 /bin/bash /usr/local/wdc/fuel-gauge
root       683  0.0  0.8    560   244 ?        S    05:35   0:01 /usr/local/wdc/heat-monitor
root       705  0.0  0.6    552   188 ?        S    05:35   0:00 /sbin/keyring
root       768  0.0  1.0   1296   316 ?        S    05:36   0:00 /usr/sbin/inetd
root       772  0.0  1.1    740   348 ?        S    05:36   0:00 /sbin/mDNSResponderPosix -f /etc/mDNSResponderPosix -b
root       775  0.0  2.4   1948   748 ?        Ss   05:36   0:00 /usr/local/samba/sbin/nmbd -D -s/var/oxsemi/smb.conf -l/var/log
www-data   779  0.0  2.8   2700   852 ?        S    05:36   0:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
www-data   783  0.0 31.0  12056  9312 ?        S    05:36   0:15 perl /usr/www/lib/nasMaster.pl
root       796  0.0  1.0   1288   324 ?        S    05:36   0:00 /usr/sbin/crond -c /etc/crontabs
root       800  0.0  1.0   1288   320 ?        S    05:36   0:00 udhcpc -n -p /var/run/udhcpc.eth0.pid -i eth0 -H MyBookWorld
root       809  0.0  1.1   1288   356 ttyS0    Ss+  05:36   0:00 /sbin/getty -L ttyS0 115200 vt100
root       810  0.0  1.2   1284   372 ?        Ss   05:36   0:00 /sbin/syslogd -n -m 0
root       811  0.0  1.2   1284   368 ?        Ss   05:36   0:00 /sbin/klogd -n
root       812  0.0  0.4   1300   144 ?        S    05:36   0:00 /bin/httpd -p 8080 -h /var/webif -r MyBook
root      2000  0.0  3.9   4736  1188 ?        Ss   15:45   0:00 /usr/sbin/sshd: aceacebaby [priv]
1002      2009  0.1  3.0   4780   924 ?        S    15:47   0:08 /usr/sbin/sshd: aceacebaby@pts/0
1002      2010  0.0  3.3   1880  1004 pts/0    Ss+  15:47   0:00 -sh
root      2015  0.0  3.5   1604  1072 pts/0    S+   15:48   0:02 -bash
root      2153  0.0  7.2   2612  2180 pts/0    S+   16:15   0:03 ushare -x
root      2154  0.0  7.2   2612  2180 pts/0    S+   16:15   0:00 ushare -x
root      2155  0.0  7.2   2612  2180 pts/0    S+   16:15   0:00 ushare -x
root      2156  0.0  7.2   2612  2180 pts/0    S+   16:15   0:00 ushare -x
root      2159  0.3  7.2   2612  2180 pts/0    S+   16:15   0:21 ushare -x
root      2160  0.0  7.2   2612  2180 pts/0    S+   16:15   0:00 ushare -x
root      2161  0.0  7.2   2612  2180 pts/0    S+   16:15   0:00 ushare -x
root      2323  0.0  0.7    564   220 ?        S    17:47   0:00 sleep 300
root      2326 12.0  1.3   1400   416 pts/0    R+   17:52   0:00 ps -auxww
[root@MyBookWorld src]#

_________________
Me flickr
Image


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Aug 07, 2008 22:46 
User avatar
Sitting balls-back folder

Joined: 30th Mar, 2008
Posts: 10206
I just checked, my ushare is being run
Code:
ushare -D -f path-to-.conf 1>/dev/null 2>/dev/null </dev/null
by the boot startup script.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Fri Aug 08, 2008 6:37 
User avatar
making out to faces of death

Joined: 1st Apr, 2008
Posts: 2686
Location: Sadville
Thanks. I'll try looking at my startup stuff. There were instructions about putting things into init.d or something but my knowledge is limited to "monkey see, monkey do" following web page step by steps, and they didn't work yet. :munkeh:

_________________
Me flickr
Image


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Fri Aug 08, 2008 9:56 
User avatar

Joined: 30th Mar, 2008
Posts: 32624
AceAceBaby wrote:
Thanks. I'll try looking at my startup stuff. There were instructions about putting things into init.d or something but my knowledge is limited to "monkey see, monkey do" following web page step by steps, and they didn't work yet. :munkeh:
I know how to do this but it's difficult to write a walkthrough for.

Some basics: /etc/init.d will contain a startup script for each service on the system. Pick the simplest (i.e. the shortest, pretty much) and copy it to a new name called ushare. Edit that one to start ushare instead (you'll need to change the command line it invokes, any files it creates under /var/run, and so on -- basically replace any mention of the original program with ushare). If you can get to the place where '/etc/init.d/ushare start' kicks it off you're laughing and we'll make it so it starts on boot.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Fri Aug 08, 2008 10:16 
User avatar
Sitting balls-back folder

Joined: 30th Mar, 2008
Posts: 10206
richardgaywood wrote:
Pick the simplest (i.e. the shortest, pretty much) and copy it to a new name called ushare.sh.
Genuine FTFY.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Fri Aug 08, 2008 10:22 
User avatar

Joined: 30th Mar, 2008
Posts: 32624
BikNorton wrote:
richardgaywood wrote:
Pick the simplest (i.e. the shortest, pretty much) and copy it to a new name called ushare.sh.
Genuine FTFY.
Can't argue with that.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Fri Aug 08, 2008 13:32 
User avatar
making out to faces of death

Joined: 1st Apr, 2008
Posts: 2686
Location: Sadville
This is in there from the installation instructions I'd followed:

Code:
#!/bin/sh -e
#
# uShare init script
#
### BEGIN INIT INFO
# Provides:          ushare
# Required-Start:    $local_fs $syslog $network
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: uShare
# Description:       uShare UPnP (TM) A/V & DLNA Media Server
#                    You should edit configuration in /etc/ushare.conf file
#                    See http://ushare.geexbox.org for details
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/ushare
NAME=ushare
DESC="uShare UPnP A/V & DLNA Media Server"
PIDFILE=/var/run/ushare.pid
CONFIGFILE=/etc/ushare.conf

# abort if no executable exists
[ -x $DAEMON ] || exit 0

# Get lsb functions
. /lib/lsb/init-functions
. /etc/default/rcS

[ -f /etc/default/ushare ] && . /etc/default/ushare

checkpid() {
  [ -e $PIDFILE ] || touch $PIDFILE
}

check_shares() {
  if [ -r "$CONFIGFILE" ]; then
    . $CONFIGFILE
    [ -n "$USHARE_DIR" ] && return 0
  fi
  return 1
}

case "$1" in
  start)
    log_daemon_msg "Starting $DESC: $NAME"
    if ! $(check_shares); then
      log_warning_msg "No shares avalaible ..."
      log_end_msg 0
    else
      checkpid
      start-stop-daemon --start --quiet --background --oknodo \
        --make-pidfile --pidfile $PIDFILE \
        --exec $DAEMON -- $USHARE_OPTIONS
      log_end_msg $?
    fi
  ;;
  stop)
    log_daemon_msg "Stopping $DESC: $NAME"
    start-stop-daemon --stop --signal 2 --quiet --oknodo --pidfile $PIDFILE
    log_end_msg $?
  ;;
  reload|force-reload)
    log_daemon_msg "Reloading $DESC: $NAME"
    start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON
    log_end_msg $?
  ;;
  restart)
    $0 stop
    $0 start
  ;;
  *)
    N=/etc/init.d/$NAME
    log_success_msg "Usage: $N {start|stop|restart|reload|force-reload}"
    exit 1
  ;;
esac

exit 0


I have been running ushare from /ushare-1.1a/src which is where it had compiled. I copied it to /usr/bin in case that would help, but it didn't.

_________________
Me flickr
Image


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Sat Aug 09, 2008 3:02 
User avatar
making out to faces of death

Joined: 1st Apr, 2008
Posts: 2686
Location: Sadville
BikNorton wrote:
I just checked, my ushare is being run
Code:
ushare -D -f path-to-.conf 1>/dev/null 2>/dev/null </dev/null
by the boot startup script.


Fingers crossed but it seems that the -D switch has worked after all. Thanks for all the suggestions!

_________________
Me flickr
Image


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Sat Aug 09, 2008 6:32 
Excellent Member

Joined: 14th Jul, 2008
Posts: 60
The -D switch means "run in daemon mode" which is what you wanted, so... :)


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Wed Jun 02, 2010 12:04 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69809
Location: Your Mum
Holla, geeks.
A quick one.
I'm using SCP -r to fetch a directory of files. Can I make it ignore files greater than (say) five meg?

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Wed Jun 02, 2010 12:09 
User avatar
Sitting balls-back folder

Joined: 30th Mar, 2008
Posts: 10206
That sounds like the sort of thing you'll need a script for.

Edit: The manpage implies the same.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Wed Jun 02, 2010 12:12 
SupaMod
User avatar
Commander-in-Cheese

Joined: 30th Mar, 2008
Posts: 49252
Yep. Use find to get all the small files, then scp through that list.

_________________
GoddessJasmine wrote:
Drunk, pulled Craster's pork, waiting for brdyime story,reading nuts. Xz


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Wed Jun 02, 2010 12:12 
User avatar
Heavy Metal Tough Guy

Joined: 31st Mar, 2008
Posts: 6634
Could you use rsync with the "--max-size" option? I think that can work over ssh.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Wed Jun 02, 2010 12:18 
User avatar
I forgot about this - how vain

Joined: 30th Mar, 2008
Posts: 5979
find -size 40 | scp ....

EDIT: Or what Craster said....

_________________
Curiosity wrote:
The Rev Owen wrote:
Is there a way to summon lave?

Faith schools, scientologists and 2-D platform games.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Wed Jun 02, 2010 12:29 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69809
Location: Your Mum
Ta.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Wed Jun 02, 2010 12:43 
SupaMod
User avatar
Commander-in-Cheese

Joined: 30th Mar, 2008
Posts: 49252
Actually, won't find -size return every file of that size or larger? You might have to fiddle about doing that, then eliminating those files from an ls, then copying what's left.

_________________
GoddessJasmine wrote:
Drunk, pulled Craster's pork, waiting for brdyime story,reading nuts. Xz


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Wed Jun 02, 2010 12:46 
SupaMod
User avatar
Commander-in-Cheese

Joined: 30th Mar, 2008
Posts: 49252
Oh, wait - Find !-size 40 |scp....

Not sure of my syntax around where that ! operator goes.

_________________
GoddessJasmine wrote:
Drunk, pulled Craster's pork, waiting for brdyime story,reading nuts. Xz


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Wed Jun 02, 2010 12:58 
User avatar
I forgot about this - how vain

Joined: 30th Mar, 2008
Posts: 5979
Or I think you can specify a range with

find -size +30 -size -100

(more than 30, less than 100)

_________________
Curiosity wrote:
The Rev Owen wrote:
Is there a way to summon lave?

Faith schools, scientologists and 2-D platform games.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Wed Jun 02, 2010 12:58 
User avatar
I forgot about this - how vain

Joined: 30th Mar, 2008
Posts: 5979
This looks like a good page: http://www.grymoire.com/Unix/Find.html#uh-7

_________________
Curiosity wrote:
The Rev Owen wrote:
Is there a way to summon lave?

Faith schools, scientologists and 2-D platform games.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Wed Jun 02, 2010 14:34 
User avatar
MR EXCELLENT FACE

Joined: 30th Mar, 2008
Posts: 2568
use rsync for this, as noted.

_________________
This man is bound by law to clear the snow away


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Jul 22, 2010 14:25 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69809
Location: Your Mum
Code:
[root@web1 panel]# chown root airmiles_standard.log
[root@web1 panel]# rm airmiles_standard.log
rm: remove regular file `airmiles_standard.log'? y
rm: cannot remove `airmiles_standard.log': Permission denied
[root@web1 panel]# ls -lh airmiles_standard.log
-rwxrwxrwx  1 root apache 4.6K May  9  2008 airmiles_standard.log


What the Hell?

I'm root, before anyone asks.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Jul 22, 2010 14:28 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69809
Location: Your Mum
Hmm, the folder it's in looks like this
Code:
drwxrwxrwx   2 root     apache 4.0K Aug  4  2009 panel

What's with the '2'? Everything else is 1 (or 31 :S).

[edit]Oh yeah, that's links. Dull. Would that stop me from being able to change anything inside the folder?

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Jul 22, 2010 15:08 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69809
Location: Your Mum
Right, fuck that, that's all sorted now.
NEW PROBLEM
Look at all the nice space on my new server:
Code:
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             950M  220M  682M  25% /
tmpfs                 1.9G     0  1.9G   0% /lib/init/rw
udev                   10M   60K   10M   1% /dev
tmpfs                 1.9G     0  1.9G   0% /dev/shm
/dev/sda5             4.7G  1.2G  3.6G  25% /usr
/dev/sda6             4.7G  194M  4.5G   5% /var
/dev/sda7             687G  5.1M  687G   1% /home
none                  1.9G     0  1.9G   0% /tmp

But oh noes - the /home directory is fucking huge, whereas the /var one is tiny!

How can I shift 500GB from /home to /var?

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Jul 22, 2010 15:33 
User avatar

Joined: 27th Jun, 2008
Posts: 6183
Use a Live CD or the recovery shit to run "parted".

parted instructions

_________________
"Wullie's [accent] is so thick he sounds like he's chewing on haggis stuffed with shortbread and heroin" - Dimrill
"TOO MANY FUCKING SWEARS!" - Mary Shitehouse


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Jul 22, 2010 16:28 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69809
Location: Your Mum
Ah yes - I should perhaps have pointed out that this is a web server.

Doesn't matter now, I've used a symlink. HACKITY HACK HACK.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Jul 22, 2010 16:42 
User avatar

Joined: 27th Jun, 2008
Posts: 6183
I guessed it might have been a remote server, but could you no have booted it into a rescue mode all the same? Surely there's something incase it goes tits up?

_________________
"Wullie's [accent] is so thick he sounds like he's chewing on haggis stuffed with shortbread and heroin" - Dimrill
"TOO MANY FUCKING SWEARS!" - Mary Shitehouse


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Jul 22, 2010 16:54 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69809
Location: Your Mum
Not to my knowledge. I assume I wouldn't be able to telnet in if that happened?

I could get a little man to go out and do it for me, but he costs money.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Jul 22, 2010 16:55 
User avatar
Skillmeister

Joined: 27th Mar, 2008
Posts: 27023
Location: Felelagedge Wedgebarge, The River Tib
All this is giving me horrible flashbacks to my University days. I keep dreaming about that.

_________________
Washing Machine: Fine. Kettle: Needs De-scaling. Shower: Brand new. Boiler: Fine.
Archimedes Hotdog Rhubarb Niner Zero Niner.


Top
 Profile  
 
 Post subject: Re: Unix Spods
PostPosted: Thu Jul 22, 2010 16:56 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69809
Location: Your Mum
What did you do at Uni?

[edit]"Drink"

Okay, what did you read?

[edit][edit]"Comics"

Nnnnnngh.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 52 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: The Greys, Vogons and 0 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 within this thread:
You are using the 'Ted' forum. Bill doesn't really exist any more. Bogus!
Want to help out with the hosting / advertising costs? That's very nice of you.
Are you on a mobile phone? Try http://beex.co.uk/m/
RIP, Owen. RIP, MrC. RIP, Dimmers.

Powered by a very Grim... version of phpBB © 2000, 2002, 2005, 2007 phpBB Group.