LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 04-08-2006, 09:12 PM   #1
animehair
Member
 
Registered: Sep 2004
Location: NJ
Distribution: Gentoo
Posts: 104

Rep: Reputation: 15
How-To Write a Linux Daemon (a question)


I want to write a cron script or daemon that will scan a given directory for torrent files, and seed them. Then it will stop the process at a certain time. The reason I want to do this is because bittorrent KILLS my internet connection. I want to share, but its not feasible during working hours. So I figured I could create an automatic way of sharing during off-peak morning hours.

Would someone point me in the right direction to get started on this.
 
Old 04-08-2006, 10:23 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
I'd write two little shell scripts, one to seed all the files and the other to kill all the bitorrent processes. Have cron run the first whenever you want to start the seeding and the second when you want to shut it down. The killall command might be useful for the second script (e.g. killall bittorrent would kill all the bittorrent processes. If you don't want to kill every last one, you could write a more advanced script to check the process start time (grep the ps aux results) and kill only those started at the same time your first job ran. A little hackish, but it should work.
 
Old 04-09-2006, 07:51 AM   #3
animehair
Member
 
Registered: Sep 2004
Location: NJ
Distribution: Gentoo
Posts: 104

Original Poster
Rep: Reputation: 15
What if I wanted to incorporate logging to track total upload/dowload MB for each torrent? Can you do that with a simple bash script?
 
Old 04-09-2006, 08:10 AM   #4
Progmaker
Member
 
Registered: Sep 2004
Location: Kaunas, Lithuania
Distribution: Knoppix, WinXP PRO SP2, OpenSUSE 10.0 OSS
Posts: 30

Rep: Reputation: 15
Some time ago I wound a very good article, how to write a deamon on Linux: "Linux Daemon Writing HOWTO". This is on the C programming language: http://www.linuxprofilm.com/articles...mon-howto.html
 
Old 04-10-2006, 07:00 AM   #5
animehair
Member
 
Registered: Sep 2004
Location: NJ
Distribution: Gentoo
Posts: 104

Original Poster
Rep: Reputation: 15
hmm, ya that article is pretty good. thanks...probably the cron script would be the easiest method, but Im going to try both methods.
 
Old 04-10-2006, 10:46 AM   #6
Progmaker
Member
 
Registered: Sep 2004
Location: Kaunas, Lithuania
Distribution: Knoppix, WinXP PRO SP2, OpenSUSE 10.0 OSS
Posts: 30

Rep: Reputation: 15
Yeah, so do I liked this article, becouse I want to create a Linux firewall, so I need to know, how to put a program in memory
But, I think, I'll write a Linux module better...
 
  


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
OpenSUSE FTP Daemon and Firewall Config Question anon111 Linux - Newbie 5 12-09-2005 04:15 PM
show me how to write a daemon program? shrike_912 Programming 2 06-04-2004 01:28 PM
smbd (samba) daemon startup question GetCool Debian 3 11-16-2003 03:22 PM
Network Daemon Question ? chamkila Linux - General 3 01-20-2003 03:10 PM
Question : Possible to change Daemon Names During Start Up? Kaj Linux - General 1 05-29-2001 02:15 PM

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

All times are GMT -5. The time now is 05:26 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
Open Source Consulting | Domain Registration