Project

General

Profile

« Previous | Next » 

Revision 14392

bin/make_backups: run with initial "." so background processes will be owned by the invoking shell

View differences:

make_backups
1
#!/bin/bash
2
cd "$(dirname -- "${BASH_SOURCE[0]}")/.."
1
#!/bin/bash -e
2
# usage: . self
3
set -o errexit -o pipefail # errexit since may be called from shell
3 4

  
4
set -x
5
if test "$1" = .; then set --; fi # was .-included without args, so $@ is wrong
5 6

  
6
make backups/TNRS.backup-remake &
7
dump_opts=${dump_opts---exclude-schema=public} \
7
main()
8
{
9
	pushd "$(dirname -- "${BASH_SOURCE[0]}")/.."
10
	
11
	if test "${BASH_LINENO[1]}" = 0; then # was run without initial "."
12
		echo "usage: . $self (note initial \".\")"|fold -s >&2
13
		return 0 # not nonzero because this will close the shell
14
	fi
15
	
16
	set -x
17
	
18
	make backups/TNRS.backup-remake &
19
	dump_opts=${dump_opts---exclude-schema=public} \
8 20
make backups/vegbien.$version.backup/test &
9
sleep 10 # wait for backup files to be created
10
backups/fix_perms
11
wait # wait for asynchronous commands
21
	sleep 10 # wait for backup files to be created
22
	backups/fix_perms
23
}
24
main "$@"

Also available in: Unified diff