[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Automated commands



> Hello,
>     This may sound a bit stupid but I am looking for a way to automate
> certain functions I do. Its kinda like a batch file on a windows system it
> just saves me typing stuff in over and over again.
> 
> lets say I wanna automate this function and probably others
> 
> /usr/bin/makemap hash /etc/virtusertable < /etc/virtusertable
> 
> So lets say I am at the command prompt and I just type makemehash it then
> runs the above.
> I run quite a lot of commands like this and some of them very long I was
> just wondering if there was a way of saving myself typing this out each time
> I log in, and yes I know about the Tab function for completeing the
> sentacnes :)
> 
> Thanks
> 
> 
> Doug
> 
> _______________________________________________
> cobalt-users mailing list
> cobalt-users@xxxxxxxxxxxxxxx
> To Subscribe or Unsubscribe, please go to:
> http://list.cobalt.com/mailman/listinfo/cobalt-users
> 

Hi.

I'm not sure if this will answer your question but there are two ways to
automate certain methods:

1) for typing "makemash" only, you can set up an alias for you command. This
is made by editing the file '.profile' in you 'users'-directory. Presuming
you will use this alias being 'admin' you look for '.profile' in
/home/sites/home/users/admin

If found you can edit this file with

pico .profile


add a line like this:

alias makemash="/usr/bin/makemap hash /etc/virtusertable <
/etc/virtusertable"

(in one line)
and save this file.

Done.

2) for creating an entire batch as known from windows you can create a new
file, 'mybatchfile.sh', for example, put in all commands delimited by ';' at
the end of each command and save.

You can execute this file by typing ./mybatchfile.sh

Any errors will be reported...

HTH,

Hendrik.