LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-02-2009, 11:58 AM   #1
tcyeo
LQ Newbie
 
Registered: Apr 2009
Posts: 3

Rep: Reputation: 0
crontab is failed to execute my python script


hi everyone, here is my problem when using crontab...
i am using linux mint 5...
i am trying to execute 1 shell script and 1 python script
the shell script is run normally, but the python script cannot be execute... while i try using execute using terminal its run normal...

here is my crontab -e:
*/5 * * * * /home/inamorato/Desktop/psm/scripts/find-bluetooth.sh /home/inamorato/Desktop/psm/data/bt-devices.csv
*/2 * * * * /home/inamorato/Desktop/psm/execute-server.py

the 1st command which recurrent every 5 mins is run normal in crontab job but the 2nd command cannot be execute...

when i try to run the task from gnome-schedule, an error pop up...
error message:

ERROR: No section: 'sql'
Exception exceptions.AttributeError:v "'outgoing' object has no attribute 'conn'" in<bound method Outgoing._del_of <Outgoing(Thread-1,initail)>>
ignored

i don't really know what is happening here... any1 can help me please?

and here is the python scripts i trying to execute

execute-server.py
----------------------------------------
----------------------------------------
#!/usr/bin/python
from Bluvert.Outgoing import Outgoing
import sys

try:
outgoing = Outgoing()
outgoing.run()
except Exception, ERR:
print "ERROR: " + ERR.message
sys.exit(2)

Outgoing.py
---------------------------
---------------------------
#!/usr/bin/python
from pysqlite2 import dbapi2 as sqlite
from threading import Thread
import Base
from SendWorker import SendWorker
import ConfigParser
import string
import sys
import os
import shutil
import datetime, time

class Outgoing(Thread, Base.Base):
def __init__(self):
Thread.__init__(self)
Base.Base.__init__(self)

def run(self):
active_adapters = self.get_adapters_in_neighbourhood()
self.dbg("There are '" + str(len(active_adapters)) + "' adapters in your bluetooth neighbourhood")

for adapter in active_adapters:
sender = SendWorker(adapter)
sender.send_outstanding_messages()

def get_adapters_in_neighbourhood(self):
result = []
bluetooth_csv_file = self.config.get("data", "current_bluetooth_devices")

if os.path.exists(bluetooth_csv_file) != 1:
raise Exception("Bluetooth CSV file '" + bluetooth_csv_file + "' does not exist")

f = open(bluetooth_csv_file, "r")

for line in f:
elements = line.split(";")
result.append(elements[0])

return result



thanks in advance...
 
Old 04-04-2009, 09:36 AM   #2
sathiyamoorthy
Member
 
Registered: Feb 2008
Posts: 32

Rep: Reputation: 15
Is this is how you will execute in command line also ?
/home/inamorato/Desktop/psm/execute-server.py

Or you will execute in some other way, if so then you should place that command in the crontab. And i believe there can be some permission related issues ?
 
Old 04-05-2009, 05:39 AM   #3
tcyeo
LQ Newbie
 
Registered: Apr 2009
Posts: 3

Original Poster
Rep: Reputation: 0
yaya thanx sathiyamoorthy.... i alrd found the way to solve it...
 
Old 04-05-2009, 05:55 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Quote:
Originally Posted by tcyeo View Post
yaya thanx sathiyamoorthy.... i alrd found the way to solve it...
And in the spirit of the community, can you share the solution?
 
Old 04-06-2009, 12:14 AM   #5
tcyeo
LQ Newbie
 
Registered: Apr 2009
Posts: 3

Original Poster
Rep: Reputation: 0
crontab cannot find the config file...
so create another .sh file put like this:

cd /home/inamorato/Desktop/psm/
/home/inamorato/Desktop/psm/execute-server.py




then solve...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I can execute shell script from CLI but failed to do via cron UltraSoul Linux - Software 2 06-24-2008 11:10 PM
Script doesn't execute in crontab jis0501 Linux - General 2 08-04-2007 08:09 AM
script in crontab do not execute or take proper environment of user mayank_a Linux - Server 1 07-02-2007 06:03 AM
Failed to execute cgi script in Apache!! baby_linu Linux - Newbie 4 06-30-2004 05:23 PM


All times are GMT -5. The time now is 06:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration