sudo gainroot apt-get install wget wget http://www.miskiewicz.org/files/alarmcleaner.py python alarmcleaner.py
sudo gainroot cp /home/user/MyDocs/alarm_queue.copy.ini /var/cache/alarmd/alarm_queue.ini
import os import shutil # file names filename1 = '/var/cache/alarmd/alarm_queue.ini' filename2 = '/home/user/MyDocs/alarm_queue.copy.ini' # make a copy shutil.copy(filename1, filename2) # open files f1 = open(filename2, 'r') f2 = open(filename1, 'w') # read file 1 f1lines = f1.readlines() # write first 3 lines f2.write(f1lines[0] + f1lines[1] + f1lines[2]) tmp = [] howMany1 = 0 howMany2 = 0 # do the magic for i in range(3, len(f1lines)): tmp.append(f1lines[i]) # empty lines indicate ends of single alarms if len(f1lines[i]) < 2: foundosso = False foundcalendar = False howMany1 = howMany1 + 1 # check if there are these two specific lines in alarm description for j in range(0, len(tmp)): if tmp[j] == 'attr0.attr_data.sval: osso-clock\n': foundosso = True if tmp[j] == 'action1.dbus_interface: com.nokia.calendar\n': foundcalendar = True # if it is osso-clock and not calendar, do nothing, if else write to new file if not(foundosso and not(foundcalendar)): for k in range(0, len(tmp)): f2.write(tmp[k]) f2.write('\n') else: howMany2 = howMany2 + 1 tmp = None tmp = [] f1.close() f2.close() print 'Done' print 'Total alarms found: ' + str(howMany1) print 'Alarms removed: ' + str(howMany2) print '(Rest of alarms is from calendar etc., I tried to keep them)' print 'Please reboot your phone now'