This file is indexed.

/usr/share/doc/sanduhr/examples/ex-email.py is in sanduhr 1.93-4.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 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
#! /usr/bin/env python

"""ex-email.py - Delivering the alarm by email

This file contains a more involved example for
SandUhr's CORBA support.  It implements and uses an
AlarmAction object, which delivers the alarm per email.

To use this example, you must adjust the variables
EMAIL and SENDMAIL to fit your local setup.  If you
run this script it should open a timer window and
start to sleep.  Until 60 seconds it should send an
email and then quit."""

EMAIL = "Addressee <some@email.address>"
SENDMAIL = "/usr/sbin/sendmail"

import os
import CORBA, oaf
import SandUhr, SandUhr__POA

orb = oaf.init()

class SendMailAlarm(SandUhr__POA.AlarmAction):
    def __init__(self):
        self.NeedsPopup = CORBA.FALSE

    def Attach(self, timer):
        pass

    def Detach(self, timer):
        orb.shutdown(1)

    def Deliver(self, timespec, message):
        p = os.popen("%s -t" % SENDMAIL, "w")
        p.write("To: %s\n" % EMAIL)
        p.write("Subject: SandUhr: %s\n" % message)
        p.write("\n") # blank line separating headers from body
        p.write("A SandUhr timer has expired.\n")
        p.write("  alarm message: %s\n" % message)
        p.write("  alarm time: %s\n" % timespec)
        sts = p.close()
        if sts:
            print "Sendmail exit status", sts

poa = orb.resolve_initial_references("RootPOA")
alarm = SendMailAlarm()._this()
poa._get_the_POAManager().activate()

factory = oaf.activate("repo_ids.has('IDL:SandUhr/TimerFactory:1.0')",[])
timer = factory.CreateTimer ("+60s", "The example timer has reached its time")
timer.Alarm = alarm

orb.run()