I am attempting to set a ulimit inside of a script to be run by TWS/Maestro. Can't figure it out. Does anyone have any ideas? :-/
I think the easiest thing, and which might cut out some other problems for you, is to source the environment (user or global) into the script.
. /etc/profile # Read in the system profile
. /home/user/.profile # read in the users profile
That way you're script would inherit the environment that the user would be operating under, so you could test your theory outside of the script (or outside of running the script in cron) and be reasonably sure that the outcome you get is the same that you will get when the script runs.
To just set the ulimit - you can also just put that in your script. That setting will change back to whatever your ulimit is once the script exits, of course
ulimit -n 2048 # set the number of open files
Apologies if I misremembered the "-n" option to ulimit as I'm not in front of a computer to verify whether I'm correct, but that's the gist of it and you can set all the options to the ulimit within the script in that fashion.
Hope that helps :)
Thanks for the suggestions but still isn't working. I have attempted to set the ulimit within the script with ulimit -f unlimited and this is running as the root user but it isn't setting the filesize limit correctly. I have even tried putting it in with env ulimit -f unlimited, still no luck. This is bugging the heck out of me. Everything works fine from command line and crontab, this is only happening when I'm submitting the job through TWS. :ooh:
Isn't it: setenv ulimit -f -1
I think that -1 means unlimited.
Also, try setenv instead of just env.