On Sun, 31 Jan 1999, Jeroen Pluimers wrote:

> Jacques,
> 
> > have also produce a new module called shellmod
> > (ftp.solucorp.qc.ca/pub/linuxconf/modules) which might be a great
> > interest. The help file is missing though.
> 
> What's this modules supposed to do?

You can find the help at
http://www.solucorp.qc.ca/linuxconf/help.files/shellmod/intro.html

This allows one to write linuxconf modules using shell scripts. You can
also write standalone utilities with that. The nice thing is that a simple
shell script will have both a text and GUI interface. I am including a
small shellmod script. This script pops a dialog where you enter a
directory path and a number of days and it will pops a list of all files
in that directory which have not been accessed since that amount of days.

This script is a standalone script (just execute it) and a modules as
well. It registers in the Miscellaneous service menu in linuxconf.

You can even write co-managers with shellmod. A simple shell script can
augment the user account dialog for example with new fields and
validations.

Enjoy!

---------------------------------------------------------------------
#!/usr/bin/shellmod
# Find old files in directories. To test, either do
#       shellmod findold.sh
# or
#       linuxconf --modulemain shellmod --setmod findold.sh
#    and visit the "misc services" menu. Requires linuxconf 1.13r12
. /usr/lib/linuxconf/lib/shellmod-lib.sh

register (){
        echo regmenu main MENU_MISCSERV \"Find old files\"
}
filedo(){
        echo notice \"do something with file $1\"
}
main(){
        echo DIALOG
        echo newf_str dir \"Directory to scan\" $1
        echo newf_num days \"Number of days\" 10
        echo edit \"find old files\" \"Front-end to the find command\"
        dispatch
        echo end
        if [ "$CODE" = "accept" ] ; then
                echo DIALOG_LIST
                echo newf_head \"Files older than $days days\"
                find $dir -atime +$days | while read file
                do
                        echo new_menuitem \"filedo $file\" $file
                done
                echo editmenu \"Old files\" \"\"
                dispatch
                echo end
        fi
}
dispatch
----------------------------------------------------------------------

---------------------------------------------------------
Jacques Gelinas <[EMAIL PROTECTED]>
Check out Linuxconf at http://www.solucorp.qc.ca/linuxconf
New modules: mgettyconf, managerpm


---
You are currently subscribed to linuxconf as: [[email protected]]
To unsubscribe, forward this message to [EMAIL PROTECTED]

Reply via email to