LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-02-2013, 12:12 PM   #1
tcashin
LQ Newbie
 
Registered: Oct 2006
Posts: 2

Rep: Reputation: 0
cron job can't access /dev/ttyS0


I have a script to log data from the serial port (via dd if=/dev/ttyS0 of=data.log) and I would like to run as a cron job. Works fine when I am logged on, but if I am not logged on I get a permission denied error from the dd command. i.e. I don't have permission to access /dev/ttyS0 unless I am logged on to the system. Note that I do not have root access and the cron job is executed from my personal account.

I don't know much about cron and access to physical ports. I am wondering why the cron job runs and dd can access /dev/ttyS0 without a hitch when I am logged on, but doesn't work when I'm logged off?

Thanks!
 
Old 10-02-2013, 12:34 PM   #2
elucches
Member
 
Registered: Jan 2011
Posts: 108

Rep: Reputation: 11
Perhaps adding
Code:
. /etc/profile
and
Code:
. /home/user/.bashrc
to the script?
 
Old 10-03-2013, 12:18 PM   #3
tcashin
LQ Newbie
 
Registered: Oct 2006
Posts: 2

Original Poster
Rep: Reputation: 0
Tried adding -l (i.e. #!/bin/bash -l) which should have the same effect as adding ". /etc/profile" (correct?) and still does not work.
 
  


Reply



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
Link /dev/mouse -> /dev/ttyS0 undone at reboot. stf92 Slackware 4 12-07-2012 05:37 PM
Serial Port Access Denied using open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY); morty346 Programming 11 01-02-2011 05:23 PM
Serial Port Access Denied using open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY); morty346 Linux - Newbie 4 02-11-2009 08:13 AM
cron job running PHP script to update MySQL - access denied error Beauford2008 Linux - Newbie 9 09-24-2008 07:17 PM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 08:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:29 PM.

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
Open Source Consulting | Domain Registration