~ubuntu-branches/debian/jessie/smstools/jessie

« back to all changes in this revision

Viewing changes to scripts/smsresend

  • Committer: Bazaar Package Importer
  • Author(s): Jan Wagner
  • Date: 2010-06-21 10:19:52 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20100621101952-pz5h5zctan8vumbi
Tags: 3.1.10-0.1
* Non-maintainer upload, as requested by maintainer
* New Upstream version (Closes: #586643)
* Bump Standards to 3.8.4, no changes needed
* Define source format 1.0 in debian/source/format
* Add $remote_fs as dependency for Required-Start and Required-Stop in the
  init script, removed $local_fs, which is implicit

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
# is limited.
6
6
# The script does not need any command line arguments.
7
7
 
 
8
smsd_user="smsd"
 
9
 
 
10
owner=""
 
11
if [ -f /etc/passwd ]; then
 
12
  if grep $smsd_user: /etc/passwd >/dev/null; then
 
13
    owner=$smsd_user
 
14
  fi
 
15
fi
 
16
 
8
17
failed=/var/spool/sms/failed
9
18
outgoing=/var/spool/sms/outgoing
10
19
max=5
12
21
used=0
13
22
notused=0
14
23
cd $failed
 
24
 
15
25
for file in *; do
16
26
  if [ "$file" = "*" ]; then
17
27
    echo "No failed files found"
18
 
    exit 1
 
28
    exit 0
19
29
  fi
20
30
  retry=`formail -zx Retry: < $file`
21
31
  if [ "$retry" ]; then
29
39
    used=`expr $used + 1`
30
40
    mv $file $file.old
31
41
    formail -f -I "Retry: $retry" < $file.old > $file
 
42
 
 
43
    if [ "x$owner" != x ]; then
 
44
      chown $owner $file
 
45
    fi
 
46
 
32
47
    mv $file $outgoing
33
48
    rm $file.old
34
49
  fi
35
50
done
 
51
 
36
52
echo "$used messages moved again into outgoing spool directory"
37
53
echo "$notused messages ignored because of to many retries"
 
54
 
 
55
exit 0