Umask howto or how to use a different umask for the bot

Well, I had to change the umask so the members of the group could work with the files (in my case ftp and dcc uploaded files). So (the guru will probably giggle) how we do this ?
Easy task, first of all we determine which umask will suit our task. To do so you can go the easy way with the umask shell command:

umask -S u=rw,g=rw,o=

This will produce a umask for us where the user and group have read/write access, and other (or world) have no access at all. If u want to see whats set currently (to reset it back later)
you can use also "umask -S" just without the other parameters.

umask -p 

This will give us the usual octal number we know from everywhere else + umask command, so ideal for scripting. Or you do "umask" without all the number only.
So but enough of this umask guide here, let's get down to the point of all this. Following my former example with the wish letting the group having r/w access, we can do it like this:

umask (note down number)
umask -S u=rw,g=rw,o=
iroffer -u distrobot -t /home/mygroupdistro/ -b mygroupdistrobot.conf
umask <number u wrote down earlier>

The iroffer line you can freely change, the important part are the lines before and after. They let the umask change due the fact that the umask gets handed down to the started instance, and
so affect our started bot instance. Here is a little helper script you can use to simplify the process:


# Lil' helper script for starting up an iroffer bot with a umask that differs from the users default umask
# Created by Philipp Beckers

# Please setup this variables to the values you want
IROFFERCMD="iroffer -u iroffer -b sample.config" 

# we save the original umask

# then we set the new umask and start the iroffer

# and restore the users umask

Just fill in your values for UMASKTOSET and the commandline u use for starting in IROFFERCMD. Then it switches the umask, start iroffer and switch back to your original.