467,146 Members | 1,030 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,146 developers. It's quick & easy.

Launch recording from PHP

Hello,

I'm working on a small web-script that would allow me to remotely setup
recordings to my tv-tuner (on my linux box). The idea is simple, but I'm
unsure how to accomplish it.

The idea: Using PHP generated www-page user could set mencoder to start
recording at some specified time. The command is put to the crontab
using linux "at" command.

Problem is that I don't think it is an good idea to grant www-data user
(that runs apache/php process) to tinker with audio and video hardware.
Even worse idea is to grant www-user rights to use "at" command.

I use mysql database to store some recording information and thus I
could use mysql TRIGGER-functionality to put the recording command to
crontab, however at that case I should give mysql user video and audio
priviledges. Again - not so good.

Can anybody give an good advice how to do this wihtout dangering system
security?

yours,
Jussi Rasku
Oct 18 '05 #1
  • viewed: 1948
Share:
3 Replies
The idea: Using PHP generated www-page user could set mencoder to start
recording at some specified time. The command is put to the crontab
using linux "at" command. Problem is that I don't think it is an good idea to grant www-data user
(that runs apache/php process) to tinker with audio and video hardware.
Even worse idea is to grant www-user rights to use "at" command.


Set up a cron job to periodically run a script that will perform the
action you want. The script should check the database for any work to
do at this time, and if there is nothing to do then it just exits.
Adjust the frequency of the cron job so that it matches the accuracy of
recording start time you require - say, every 5 minutes.

This way, no-one else has to be given permissions to add "at" commands
or mess with the hardware.

---
Steve

Oct 18 '05 #2
Can't you use some in-between storage?
Like: the webpage puts a record in the database,
Another process regularly checks for new entries in the database and
acts if it finds a new one.
Using this "token passing", the web process needs no access except to
the database and the tv "listener" needs no web access.

Best regards

Jussi Rasku wrote:
Hello,

I'm working on a small web-script that would allow me to remotely setup
recordings to my tv-tuner (on my linux box). The idea is simple, but I'm
unsure how to accomplish it.

The idea: Using PHP generated www-page user could set mencoder to start
recording at some specified time. The command is put to the crontab
using linux "at" command.

Problem is that I don't think it is an good idea to grant www-data user
(that runs apache/php process) to tinker with audio and video hardware.
Even worse idea is to grant www-user rights to use "at" command.

I use mysql database to store some recording information and thus I
could use mysql TRIGGER-functionality to put the recording command to
crontab, however at that case I should give mysql user video and audio
priviledges. Again - not so good.

Can anybody give an good advice how to do this wihtout dangering system
security?

yours,
Jussi Rasku

Oct 18 '05 #3
Dikkie Dik wrote:
Can't you use some in-between storage?
Like: the webpage puts a record in the database,
Another process regularly checks for new entries in the database and
acts if it finds a new one.
Using this "token passing", the web process needs no access except to
the database and the tv "listener" needs no web access.


Thanks for the tip, altough I don't like the idea of polling. However it
seems its the easiest way to do this nicely.

Perhaps I will do some kind of semaphore file the polling script checks
and the php script sets. That way there is no need for the polling sript
to handle the database everytime (shouldn't take too much system resources).

-Jussi
Oct 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Dovelet | last post: by
reply views Thread by Mad Scientist | last post: by
1 post views Thread by zhangzhi | last post: by
8 posts views Thread by jer | last post: by
reply views Thread by =?Utf-8?B?TmFndGFnZXQ=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.