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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-08-2006, 10:12 PM
|
#1
|
Member
Registered: Sep 2004
Location: NJ
Distribution: Gentoo
Posts: 104
Rep:
|
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.
|
|
|
04-08-2006, 11:23 PM
|
#2
|
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290
|
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.
|
|
|
04-09-2006, 08:51 AM
|
#3
|
Member
Registered: Sep 2004
Location: NJ
Distribution: Gentoo
Posts: 104
Original Poster
Rep:
|
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?
|
|
|
04-09-2006, 09:10 AM
|
#4
|
Member
Registered: Sep 2004
Location: Kaunas, Lithuania
Distribution: Knoppix, WinXP PRO SP2, OpenSUSE 10.0 OSS
Posts: 30
Rep:
|
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
|
|
|
04-10-2006, 08:00 AM
|
#5
|
Member
Registered: Sep 2004
Location: NJ
Distribution: Gentoo
Posts: 104
Original Poster
Rep:
|
hmm, ya that article is pretty good. thanks...probably the cron script would be the easiest method, but Im going to try both methods.
|
|
|
04-10-2006, 11:46 AM
|
#6
|
Member
Registered: Sep 2004
Location: Kaunas, Lithuania
Distribution: Knoppix, WinXP PRO SP2, OpenSUSE 10.0 OSS
Posts: 30
Rep:
|
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...
|
|
|
All times are GMT -5. The time now is 01:21 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|