Upgrade to Pro — share decks privately, control downloads, hide ads and more …

daemontools-kobanashi

yudoufu
August 11, 2015

 daemontools-kobanashi

yudoufu

August 11, 2015
Tweet

More Decks by yudoufu

Other Decks in Technology

Transcript

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

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

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

    /var/run/cron.lock preprocess.sh 30 * * * * setlock -N /var/run/cron.lock postprocess.sh • લॲཧͷ݁ՌΛड͚ͯޙॲཧΛ࣮ߦ͍ͨ͠ɺ ͱ͍͏ͷΛຖ࣌΍Δ৔߹ͳͲ • ಉ͡lockϑΝΠϧͳΒίϚϯυ͕ҧͬͯ΋ॲཧ Λ଴ͬͯ͘ΕΔ
  4. 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. envuidgid % envuidgid user command • envͷ UID / GIDʹୈ1Ҿ਺ͷuserΛઃఆ

    • ࣮ߦϢʔβʔΛม͑ΔΘ͚͡Όͳ͍ envuidgid www-data env |egrep "(GID|UID|USER)" USER=yudoufu GID=33 UID=33
  6. setuidgid % setuidgid user command • ࣮ߦ࣌ݖݶΛߜΓ͍ͨ৔߹ʹ࢖͏ • جຊతʹ͸root࣮ߦͷεΫϦϓτ಺Ͱ࢖͏ •

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