Creating Server Based Programs

Alright so here is the situation. I want to create my own ubuntu based daemon, as you did with ehcp. I am ging to make it a php application on a web server. What did you do to allow ehcp to run on a Ubuntu? What language did you make ehcp daemon out of? I know it's not just PHP, or it wouldn't install on the server. I posted what I wanted to make here.

Help would be appreciated.


That strongly depends on what you want to do with daemon.
I mean, will daemon:

  • do something in filesystem only, or in ubuntu config? (this is ehcp case)
  • or will serve something to real world, as a daemon, (ex: a webserver, or media server)
  • or will it communicate to some peripheral in your computer (your case i think, sorround media system)

    the first one is perhaps the easiest one. you can do it with almost any language. I prefered php, while coding ehcp. and, ehcp is fully php. with php, you can do almost anything in a linux system. In ehcp, i do basically, modify some files,configs, and restart some services (also some db operations)

    if you want third one, then most probably you will need another language, which is able to communicate with some peripherals. if peripherals or any file/resource in computer is accessible through some system commands, then, php is still handy. php can call any system function. I do this in ehcp.

    unfortunately, i did not read all your requirements, that you want to do. it needs to be read and to figure out, to think many things, in order to do your idea. if I would think them, I would realize your ideas.. :) then, nothing is left to you, almost. so, you need to figure it out.

  • Alright, I am strongly familiar with PHP and SQL. I want to be able to be at my laptop and type in the song I want to play, and it will play through the home system. With those, I need to set the peripheral of the speaker output on the rack server. Is this possible with those 2 languages?

    I use EHCP =)

    Yes I think,
    this way:

  • setup a mysql table that stores song list, song names, artist and file path,
  • setup a php page, where, you will be able to search for songs by name or artist, and select a song for play, selected song is marked for play, or added to a playlist, in msyql table,
  • background daemon, which is php, reads in regular intervals, for new song requests from mysql table, then, if it find some song request, play it on server, through simple "mplayer filename.mp3" command. in php, passthru("mplayer filename.mp3"); dont forget to give filename as fullpath.

    I think this way, your program ready. This may seen to you a joke, but, you may even integrate it into your ehcp ! :) ehcp daemon checks for new actions each 10 sec. you may define a new action, named, playsong, then, make ehcp play that song.... :)

  • So I want to request the song from an IP address, with an HTML interface. Won't I need apache webserver too? Can you link me to how to install those things onto my webserver?

    Say I used EHCP. Can I still be able to play the song through the system. For example, I need to connect the server to the system via ordinary speaker jack. Can the daemon set that up?

    I use EHCP =)