daemontools-kobanashi

188abc8954f5a349f8df86c8586a9b1d?s=47 yudoufu
August 11, 2015

 daemontools-kobanashi

188abc8954f5a349f8df86c8586a9b1d?s=128

yudoufu

August 11, 2015
Tweet

Transcript

  1. 6.

    setlock % setlock -n /path/to/hoge.lock command • command࣮ߦલʹlockΛߦ͍ɺϓϩηεͷॏ ෳىಈΛ๷͍Ͱ͘ΕΔ •

    -n: ॏෳىಈ͸command࣮ߦͤͣଈऴྃ • -N: ॏෳىಈ͸ϩοΫͷղ์Λ଴࣮ͬͯߦ • cronͱ૊Έ߹Θͤͯ࢖͏ͱศར
  2. 7.

    setlock - ࢖༻ྫ 00 * * * * setlock -n

    /var/run/cron.lock hugeprocess.sh • ͍͢͝Ͱ͔͍ॲཧΛຖ࣌΍Δ৔߹ • ສ͕Ұ࣍ͷ࣮ߦ͕࣌ؒདྷͯ΋ɺ࣍ͷϓϩηε ͸࣮ߦ͞Εͣऴྃ͢Δ setlock: fatal: unable to lock /var/run/cron.lock: temporary failure
  3. 8.

    setlock - ࢖༻ྫ 00 * * * * setlock -N

    /var/run/cron.lock preprocess.sh 30 * * * * setlock -N /var/run/cron.lock postprocess.sh • લॲཧͷ݁ՌΛड͚ͯޙॲཧΛ࣮ߦ͍ͨ͠ɺ ͱ͍͏ͷΛຖ࣌΍Δ৔߹ͳͲ • ಉ͡lockϑΝΠϧͳΒίϚϯυ͕ҧͬͯ΋ॲཧ Λ଴ͬͯ͘ΕΔ
  4. 10.

    envdir - ࣮ߦྫ % cat /tmp/env/IP 192.168.1.1 % cat /tmp/env/LOGDIR

    /var/log/hoge % envdir /tmp/env env | egrep "(IP|LOGIDIR)" IP=192.168.1.1 LOGDIR=/var/log/hoge • dir಺ͷϑΝΠϧ໊Λม਺໊ʹɺ಺༰Λvalueʹ • ؀ڥม਺ͱεΫϦϓτΛผ؅ཧ͠΍͘͢ͳΔ
  5. 11.

    envuidgid % envuidgid user command • envͷ UID / GIDʹୈ1Ҿ਺ͷuserΛઃఆ

    • ࣮ߦϢʔβʔΛม͑ΔΘ͚͡Όͳ͍ envuidgid www-data env |egrep "(GID|UID|USER)" USER=yudoufu GID=33 UID=33
  6. 12.

    setuidgid % setuidgid user command • ࣮ߦ࣌ݖݶΛߜΓ͍ͨ৔߹ʹ࢖͏ • جຊతʹ͸root࣮ߦͷεΫϦϓτ಺Ͱ࢖͏ •

    αϒάϧʔϓΛ൓ө͠ͳ͍ͷͰͨ·ʹਏ͍ • https://github.com/bruceg/daemontools- encore • ༗ࢤ͕௚ͨ͠Γͯ͠Δ