fetch-backup-work 5.59 KB
Newer Older
Per Cederqvist's avatar
Per Cederqvist committed
1
2
#!/bin/sh

3
TASKS=/opt/LYSrdiff/var/tasks
4
5
6
NT=$TASKS.tmp

rm -f $NT
Per Cederqvist's avatar
Per Cederqvist committed
7

8
ssh nyarlathotep ls -1 /srv/www/users \
Per Cederqvist's avatar
Per Cederqvist committed
9
 | sort \
10
 | awk '{print "lyswww-users", $1, "nyarlathotep /srv/www/users/" $1}' \
11
>> $NT
12
ssh nyarlathotep ls -1 /srv/www/projects/front \
13
 | sort \
14
 | awk '{print "lyswww-projects-front", $1, "nyarlathotep /srv/www/projects/front/" $1}' \
15
>> $NT
16
ssh nyarlathotep 'cd /srv/www/projects/roxen && ls -1 | while read d; do [ -d "$d" -a ! -L "$d" ] && echo "$d"; done' \
17
 | sort \
18
 | awk '{print "lyswww-projects-roxen", $1, "nyarlathotep /srv/www/projects/roxen/" $1}' \
19
>> $NT
20
21
22
23
24
25
echo lyswww-projects-planet root nyarlathotep /srv/www/projects/planet >> $NT
echo lyswww-main root nyarlathotep /srv/www/main >> $NT
echo nyarlathotep etc nyarlathotep /etc >> $NT
echo nyarlathotep lxc nyarlathotep /lxc >> $NT
echo nyarlathotep opt nyarlathotep /opt >> $NT
echo nyarlathotep usr-local nyarlathotep /usr/local >> $NT
26

27
ssh armitage ypcat -k auto_home \
Per Cederqvist's avatar
Per Cederqvist committed
28
29
 | sort \
 | grep -v DELETE \
30
 | grep -v membership_expired \
Per Cederqvist's avatar
Per Cederqvist committed
31
32
 | grep -v '^ *$' \
 | sed 's/:/ /' \
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
 | awk '$1 == "mailman" { next }
        $1 == "patrick" { next }
        $1 == "snapshot" { next }
        $1 == "u1" { next }
        $1 == "u2" { next }
        $1 == "u3" { next }
        $1 == "u4" { next }
        $1 == "u5" { next }
        $1 == "u6" { next }
        $1 == "lysdisk1" { next }
        $1 == "lysdisk2" { next }
        $1 == "lysdisk3" { next }
        $1 == "lysdisk4" { next }
        $1 == "lysdisk5" { next }
        $1 == "lysdisk6" { next }
        $1 == "lysdisk7" { next }
        $1 == "lysdisk8" { next }
        $1 == "lysdisk9" { next }
        $1 == "lysdisk10" { next }
        $1 == "lysdisk11" { next }
        $1 == "kheldar" { next }
        $1 == "quota1" { next }
        $1 == "sge" { next }
	{ print }' \
Per Cederqvist's avatar
Per Cederqvist committed
57
 | sed 's/^/home /' \
58
>> $NT
Per Cederqvist's avatar
Per Cederqvist committed
59

60
echo lyskom kom obsession /home/kom >> $NT
Per Cederqvist's avatar
Per Cederqvist committed
61

62
63
64
65
66
67
#echo poseidon var poseidon /var >> $NT
#echo poseidon root poseidon /root >> $NT
#ssh poseidon 'cd /var/repositories && ls -1 | while read d ; do [ -d "$d" ] && [ ! -L "$d" ] && echo "$d" ; done' \
#| grep -v '^snes9x-rediffbackup$' \
#| awk '{ print "lyssvn", $1, "poseidon", "/var/repositories/" $1 }' \
#| sort >> $NT
68

69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
echo thestral root thestral / >> $NT
echo thestral opt thestral /opt >> $NT
echo thestral usr thestral /usr >> $NT
echo thestral usr-local thestral /usr/local >> $NT
echo thestral var thestral /var >> $NT
# The root shell on thestral/ftp is csh, which won't allow escaping
# of double quotes. Therefore we need _single_ quote around the
# argument to sh -c.
ssh thestral "sh -c 'cd /home && ls -1 | while read d ; do [ -d \"\$d\" ] && [ ! -L \"\$d\" ] && echo \$d ; done'" \
| awk '{ print "thestral-home", $1, "thestral", "/home/" $1 }' \
| sort >> $NT
ssh ftp "sh -c 'df | cut -wf6 | grep ^/export/ftp/pub/ | sed \"s|^/export/ftp/pub/||\" | while read d ; do echo \$d \`echo \$d | tr / \|\` ; done'" \
| awk '$1 == "CentOS" { next }
       $1 == "FreeBSD" { next }
       $1 == "OpenBSD" { next }
       $1 == "archlinux" { next }
85
       $1 == "debian" { next }
86
       $1 == "debian-backports" { next }
87
       $1 == "debian-cd" { next }
88
       $1 == "debian-security" { next }
89
90
91
92
93
       $1 == "epel" { next }
       $1 == "fedora" { next }
       $1 == "manjaro" { next }
       $1 == "monitoring-plugins" { next }
       $1 == "ubuntu" { next }
94
95
       $1 == "ubuntu-dvd" { next }
       $1 == "ubuntu-releases" { next }
96
       { print "ftp-pub", $2, "ftp", "/export/ftp/pub/" $1 }' \
97
| sort >> $NT
98
99
100
#ssh ftp 'bash -c "cd /export/ftp/home && ls -1 | while read d ; do [ -d "\$d" ] && [ ! -L "\$d" ] && echo "\$d" ; done"' \
#| awk  '{ print "ftp-home", $1, "ftp", "/export/ftp/home/" $1 }' \
#| sort >> $NT
101

102
echo medreg sqldump medreg /var/lib/mysql-dump >> $NT
103
echo datorhandbok sqldump datorhandbok /var/lib/mysql-dump >> $NT
104

Per Jonsson's avatar
Per Jonsson committed
105
106
107
108
109
# Mail
echo bernadotte var-log bernadotte /var/log >> $NT
echo bernadotte var-spool-postfix bernadotte /var/spool/postfix >> $NT
echo bernadotte var-lib-mailman bernadotte /var/lib/mailman >> $NT
ssh bernadotte 'cd /home && ls -1 | while read d ; do [ -d "$d" ] && [ ! -L "$d" ] && echo "$d" ; done' \
Per Cederqvist's avatar
Per Cederqvist committed
110
| grep -v DELETE \
Per Jonsson's avatar
Per Jonsson committed
111
| awk '{ print "mail", $1, "bernadotte", "/home/" $1 }' \
112
113
| sort >> $NT

114
115
116
117
118
# NS and NIS
echo ns lysator ns /lysator >> $NT
echo nis lysator nis /lysator >> $NT
echo nis opt-lysator nis /opt/lysator >> $NT

119
# lysrdiff
Per Cederqvist's avatar
Per Cederqvist committed
120
121
122
echo shafan root shafan / >> $NT

# ejabberd
123
124
echo tanenbaum etc tanenbaum /etc >> $NT
echo tanenbaum var-lib tanenbaum /var/lib >> $NT
Per Cederqvist's avatar
Per Cederqvist committed
125

Per Cederqvist's avatar
Per Cederqvist committed
126
# eureka
127
128
#echo eureka etc eureka /etc >> $NT
#echo eureka admin eureka /pikedata/eureka-admin >> $NT
Per Cederqvist's avatar
Per Cederqvist committed
129

130
131
132
133
# gluten (gitlab)
echo gluten etc gluten /etc >> $NT
echo gluten repos gluten /var/opt/gitlab/backups >> $NT

Joakim Tosteberg's avatar
Joakim Tosteberg committed
134
135
#ssh eureka 'cd /pikedata/homes && /bin/ls -1d */* | sed "s%/% %" | while read zone user; do [ -d "$zone/$user" ] && [ ! -L "$zone" ] && [ ! -L "$zone/$user" ] && echo eureka-home $zone--$user eureka /pikedata/homes/$zone/$user ; done ' \
#| sort >> $NT
Per Cederqvist's avatar
Per Cederqvist committed
136

Joakim Tosteberg's avatar
Joakim Tosteberg committed
137
138
#ssh eureka 'cd /pikedata/repositories && /bin/ls -1d */* | sed "s%/% %" | while read vcs proj; do [ -d "$vcs/$proj" ] && [ ! -L "$vcs" ] && [ ! -L "$vcs/$proj" ] && echo eureka-repo $vcs--$proj eureka /pikedata/repositories/$vcs/$proj ; done ' \
#| sort >> $NT
Per Cederqvist's avatar
Per Cederqvist committed
139

Joakim Tosteberg's avatar
Joakim Tosteberg committed
140
141
#ssh eureka 'cd /pikedata/zones && /bin/ls -1d * | while read zone ; do [ -d "$zone" ] && [ ! -L "$zone" ] && echo eureka-etc $zone eureka /pikedata/zones/$zone/root/etc; done' \
#| sort >> $NT
Per Cederqvist's avatar
Per Cederqvist committed
142

143
144
145
146
# inbyggda hack
echo inbyggda-hack embedded bishibosh /embedded >> $NT
echo inbyggda-hack export-embedded bishibosh /export/embedded >> $NT

Per Cederqvist's avatar
Per Cederqvist committed
147
148
149
sort $TASKS > $TASKS.sorted
sort $NT > $NT.sorted
diff -u $TASKS.sorted $NT.sorted | grep -v ^@ | grep -v '^ '
150
151
152
echo -n '[CONFIRM] '
read line
mv -f $NT $TASKS