ctdb-scripts: Only write to /proc route flush files if they exist
[Samba.git] / ctdb / tests / eventscripts / etc-ctdb / rc.local
blob0932ab4ad03330c13bd01610140cbd568e9e51fd
1 # Hey Emacs, this is a -*- shell-script -*- !!!  :-)
3 # Use a "service" command in $PATH if one exists.
4 service ()
6     if _t=$(which "service" 2>/dev/null) ; then
7         "$_t" "$@"
8     else
9         _nice=""
10         _service "$@"
11     fi
14 nice_service ()
16     if _t=$(which "service" 2>/dev/null) ; then
17         nice "$_t" "$@"
18     else
19         _nice="nice"
20         _service "$@"
21     fi
24 # Always succeeds
25 set_proc () { : ; }
26 set_proc_maybe () { : ; }
28 get_proc ()
30     case "$1" in
31         net/bonding/*)
32             cat "$FAKE_PROC_NET_BONDING/${1##*/}"
33             ;;
34         sys/net/ipv4/conf/all/arp_filter)
35             echo 1
36             ;;
37         sys/net/ipv4/conf/all/promote_secondaries)
38             echo 1
39             ;;
40         fs/nfsd/threads)
41             echo "$FAKE_NFSD_THREAD_PIDS" | wc -w
42             ;;
43         */stack)
44             echo "[<ffffffff87654321>] fake_stack_trace_for_pid_${1}+0x0/0xff"
45             ;;
46         meminfo)
47             echo "$FAKE_PROC_MEMINFO"
48             ;;
49         *)
50             echo "get_proc: \"$1\" not implemented"
51             exit 1
52     esac
55 # Always succeed
56 iptables () { : ; }
57 ip6tables () { : ; }
58 iptables_wrapper () { : ; }
60 # Do not actually background - we want to see the output
61 background_with_logging ()
63     "$@" 2>&1 </dev/null | sed -e 's@^@\&@'
66 CTDB_INIT_STYLE="redhat"
67 PATH="${EVENTSCRIPTS_PATH}:$PATH"