Unfortunately no one can be told what fun_plug is - you have to see it for yourself.
You are not logged in.
Hi,
I am new to the dns-323, I was wondering if it possible to create a web ui for all the functions or enhance the existing one. Is something possible? I am also using a fritz box with the freetz firmware mod, for example, it is possible to control Transmission, run simple commands, setup crontab and many others. For windows users it would be much easier to use instead of putty and login and so on.
Offline
Hello,
could somebody tell me if something like this is possible and perhaps a hint how to do this? Perhaps with lighttps? And how is it possible to transform bottun klcks to linux commands?
Last edited by Stargrove1 (2010-08-17 08:01:13)
Offline
php, perl..?
install lighthttp with php support, learn some php and you can do 'anything'.
take a look at http://phpshell.sourceforge.net/ for instance.
Offline
Thanks for the hints.
Am I really the only one who thinks this might be useful ?!
Offline
Stargrove1,
I'm sure that lots of people have already added lighttps or some other web server and added what they wanted, but the problem with your request is that there is no generic need for "all the functions", whatever that means to you. And it would certainly mean different things to different people, and there is an endless amount of "functions" that could be added.
Of course to even start a task like this you need two things. One is a clear definition of what you want. Clearly a "function" to list all the /Backup/* files is a different function then mount/unmount a given USB drive. The second part is just the knowledge to write the code (and yes it is code/software) to tell what to put on the web page and what to do when someone enters something, and clicks a button. BTW there is not one language when you are talking about web programing, I prefer Perl, but there is PHP, and plain old HTML, and a ton of others. And knowing them is needed to both get the web page up, and also to call the operating system to do things like mount a drive.
Personally I really actually prefer not to do it in web form. Much easier to right a script in shell or Perl that runs in the background that say waits for a file to be created in a directory /mnt/HD_a2/startShutdown called "start", and when it sees it start a shutdown. And then just have a script run from my toolbar (PowerPro) on my Windows machine that creates that file when I click on a button. This is exactly what really happens on my system (I have another directory/file for starting a backup, and combine the two for a backup before shutting down for removal of a drive for offline storage).
Last edited by chriso (2010-08-19 07:27:49)
Offline
Thank you for this good explanation. I understand that it is different for each user, I thought about a configuration file where button names/commands start different action, I am used to do that with LabView all the time at work. So that the framework is the same for everybody, but the configuration is handled by the user. But seems that a) there is no interest and b) I do not have enough skills in Linux/web programming.
Could you provide an example script of the second way you mentioned?
Offline
Well the start of this of course how to get the shell script running in the background at start up. For that and other things I have Fonz's fun_plug (ffp) installed. You could also just create your own fun_plug shell script on the first hard drive on the DNS-323, but Fonz's ffp is much more useful to expand on.
http://dns323.kood.org/howto:ffp
With ffp installed there are two directories of interest for the ffp/start and ffp/share. I put in a file called backupCmd.sh in the ffp/start directory, and logged into the DNS-323 and made sure is has execute permissions so that it will run at start up (log in using telnet or ssh):
chmod +x /ffp/start/backupCmd.sh
backupCmd.sh contains:
------------------------------------------------------------------------------------
#!/ffp/bin/sh
# PROVIDES: backupCmd
# BEFORE: LOGIN
. /ffp/etc/ffp.subr
name="backupCmd"
start_cmd="backupCmd_start"
stop_cmd="backupCmd_stop"
required_files="/ffp/share/NAS-BackupCmd/NAS-BackupCmd.sh"
backupCmd_start()
{
echo "Setting up $name..."
/ffp/share/NAS-BackupCmd/NAS-BackupCmd.sh &
}
backupCmd_stop()
{
/ffp/bin/killall NAS-BackupCmd.sh
}
run_rc_command "$1"
____________________________________________
(Don't include the ------------------------ lines, and you can call the file and all the entries inside with backupCmd anything you like.
This just runs/stops the NAS-BackupCmd.sh script in the background (& after command is "in background") that is in the /ffp/share/NAS-BackupCmd (just a directory in the ffp/share directory I created to keep my stuff separate. If I included the real NAS-BackupCmd it would just confuse people because it is highly tailored to my backups, but what I have posted below will shutdown the DNS-323 when a file "startShutdown.txt" is created on the first drive in the DNS-323 (I actually run from a USB drive so in the real script the paths are different).
____________________
#! /bin/sh
FLAG_SHUTDOWN_FILE="/mnt/HD_a2/startShutdown.txt"
while [ 1 ]; do
if [ -f $FLAG_SHUTDOWN_FILE ]; then
echo "Signaled for shutdown"
rm $FLAG_SHUTDOWN_FILE
shutdown
exit 0
fi
sleep 5
done
_____________________________
You could have many if statements with many different files, and run basically any command the DNS-323 knows.
You could even get fancy and run commands that check the contents of the file for commands, but a simple check if the file exists or not is easier.
The echo command should show up in the ffp.log file. If you want to print another file just redirect its output to another file like:
LOG=/mnt/HD_a2/myLog.txt
echo "Log this" > $LOG # The single > creates the log file (and deletes an old version if it exists)
ls /ffp >> $LOG # The >> appends to an existing file, or creates it if it doesn't exist.
mount >> $LOG 2>&1 # The 2>&1 makes error message go to the log too.
df >> $LOG
Log into the DNS-323 and make sure the script has has execute permission:
ls -l /ffp/share/NAS-BackupCmd/NAS-BackupCmd.sh
(looks like: -rwxrwxrwx 1 Chris Users 6498 Aug 17 23:59 NAS-BackupCmd.sh) (the x's are execute permissions, (read/write/execute) for owner, group, other).
chmod +x /ffp/share/NAS-BackupCmd/NAS-BackupCmd.sh (if not right)
Once you reboot the DNS-323 the NAS-BackupCmd.sh should be running you can check that by looking at the ffp.log, and by logging into the DNS-323 and running either the "ps" or the "top" command, and you should see NAS-BackupCmd.sh as one of the running processes.
__________
Please note one thing, as written the script is going to look for the file every 5 seconds on your hard drive so that hard drive is not going to sleep. This is not a problem for me, because I run ffp and have the "flag file" on a USB Flash drive that I don't care if it doesn't sleep, but this could certainly be an issue for you. This is a case where it might be a better idea to install another web server like lighttpd and make your own commands, but running almost anything off of the hard drive instead of an USB flash drive is going to not allow your hard drive to sleep.
Last edited by chriso (2010-08-19 23:30:51)
Offline
Please also see this discussion:
http://dns323.kood.org/forum/viewtopic. … 578#p37578
Offline
Thank you again for the informations. Unfortunately I still want the spin down function of the hds. Perhaps there is a small chance that the other post leads to a solution for me.
Offline