-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrc.local
executable file
·64 lines (52 loc) · 1.53 KB
/
rc.local
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
#setting gpio using wiringpi tool:
#syntax: gpio export GPIONUMBER out|in|both to set as output, input or I/O
gpio export 24 out # Set as output.
gpio export 23 out
gpio export 22 out
gpio export 27 out
gpio export 18 out
gpio export 17 out
gpio export 25 out #lightOut2
gpio export 8 out #lightOut3
gpio export 7 out #lightOut4
gpio export 12 out #lightOut1
#mount USB hard disk
#mount /dev/sda1 /mnt/backup
#set timeout for USB hard disk to 12*5=60s, then hard disk will go in standby
/sbin/hdparm -S 12 /dev/sda
#turn raspberry WiFi off
/sbin/ifconfig wlan0 down
/sbin/iwconfig wlan0 power off
# Load firewall policies
/usr/local/sbin/myfirewallpi.sh
# needed by mon daemon (to monitor services on other devices)
mkdir /var/log/mon
chown mon /var/log/mon
# reset internet router in case of ping errors
/usr/local/sbin/netwatchdog.sh >/dev/null 2>/dev/null &
# check that domoticz is running, and restart it if it's not running for 5 minutes
/usr/local/sbin/domoticzCheck.sh &
# needed by proftp daemon
if [ ! -d /var/log/proftpd ]; then
mkdir /var/log/proftpd
chown proftpd /var/log/proftpd
service proftpd restart
fi
exit 0