Mulțumesc pentru sugestii, dar din păcate nu au funcționat următoarele
variante:
nohup sh /jffs/script.sh 2>&1 >/dev/null </dev/null &
( ( sh /jffs/script.sh ) &>/dev/null </dev/null ) &
Scriptul pornea ok în background, dar murea imediat ce închideam shell-ul :(
Varianta cu wrapper în C o să o țin minte, dar mi-e lene să mă apuc să îmi
instalez un cross-compiler/build environment pentru atâta lucru.
Pe sistem am un busybox relativ minimal - nu știu dacă mi-e de folos ceva
din el:
root@rigel:/tmp/home/root# busybox
BusyBox v1.18.4 (2011-04-08 11:40:09 EEST) multi-call binary.
Copyright (C) 1998-2009 Erik Andersen, Rob Landley, Denys Vlasenko
and others. Licensed under GPLv2.
See source distribution for full notice.
Usage: busybox [function] [arguments]...
or: busybox --list[-full]
or: function [arguments]...
BusyBox is a multi-call binary that combines many common Unix
utilities into a single executable. Most people will create a
link to busybox for each function they wish to use and BusyBox
will act like whatever it was invoked as.
Currently defined functions:
[, [[, arp, arping, ash, awk, basename, cat, chmod, cmp, cp, crond,
cut, date, dd, df, dirname, dmesg, du, echo, egrep, env, ether-wake, expr,
fgrep, find, free, ftpget, ftpput, grep, gunzip, gzip, head, ifconfig,
insmod, kill, killall, klogd, less, ln, logger, login, ls, lsmod, md5sum,
mkdir, mknod, modprobe, more, mount, mv, nc, netstat, nohup, nslookup,
pidof, ping, ping6, printf, ps, pscan, pwd, rm, rmdir, rmmod, route, sed,
sh,
sleep, sort, strings, sync, syslogd, tail, tar, telnet, telnetd, test,
top, touch, tr, traceroute, traceroute6, udhcpc, umount, uname, uptime,
usleep, vconfig, vi, watch, wc, wget, which, zcat
O altă variantă ar mai putea fi un script de cron care să lanseze comanda
periodic, iar comanda să verifice dacă pornește în buclă sau nu pe baza
unui lockfile... dar nu mi se pare elegant deloc...
Alte idei?
2014-06-02 23:26 GMT+03:00 zgrim <[email protected]>:
> On 2014-06-02 15:29:40 +0300, Adrian Popa wrote:
> > Aveți o recomandare de cum pot porni și ține în viață scriptul [...]
>
> subshells, nu știu însă dacă sintaxa e bashism (sic)
>
> ex:
> ( ( while true; do $stuff ; sleep 1; done ) &>/tmp/logfile ) &
>
> map:
> ( ) = subshell
> & = background
> &>/dev/null = 2>&1 >/dev/null
> „help wait”
>
> În fine, dacă shellu e dușmănos, poți oricând scrie un mic wrapper în C
> care să se
> daemonizeze.
>
>
> --
> perl -MLWP::Simple -e'print$_[rand(split(q.%%\n.,
> get(q{http://cpan.org/misc/japh})))]'
> _______________________________________________
> RLUG mailing list
> [email protected]
> http://lists.lug.ro/mailman/listinfo/rlug
>
_______________________________________________
RLUG mailing list
[email protected]
http://lists.lug.ro/mailman/listinfo/rlug