Skip to main content
added 495 characters in body
Source Link
klerk
  • 2.9k
  • 2
  • 19
  • 16

I am connected to remote machine Linux RH6 directly via ssh (key imported on server), when I execute a shell script with arguments for restarting the java service, I have a strange issue with ulimit:

  • when I manually run ./script.sh stop;./catalina.sh start I see that the number of open files is not OK (1024) as defined in system file limits.conf;
  • when a weekly job is executed which I have set up from cron, I have the correct value from limits.conf (16,384);
  • when I do /bin/su - user and then restart, I have the correct value
    also.

I need a solution to modify the script to somehow source my system value and have real login shell in the bash script and to have the correct number of open files when I need to restart the service manually.

Hard limit for current shell:

ulimit -Ha
open files                      (-n) 4096

Global:

cat /etc/security/limits.conf
oracle hard nofile 16384

Problem: when cron job is executed number of opened files is 16384 good!, when i run script from current shell ./script.sh stop; ./script.sh start i have 4096. Question is how to get 16384 when i run script manually ?

Ps editing of bashrc and bash_profile with ulimit -n <number> does not help.

I am connected to remote machine Linux RH6 directly via ssh (key imported on server), when I execute a shell script with arguments for restarting the java service, I have a strange issue with ulimit:

  • when I manually run ./script.sh stop;./catalina.sh start I see that the number of open files is not OK (1024) as defined in system file limits.conf;
  • when a weekly job is executed which I have set up from cron, I have the correct value from limits.conf (16,384);
  • when I do /bin/su - user and then restart, I have the correct value
    also.

I need a solution to modify the script to somehow source my system value and have real login shell in the bash script and to have the correct number of open files when I need to restart the service manually.

I am connected to remote machine Linux RH6 directly via ssh (key imported on server), when I execute a shell script with arguments for restarting the java service, I have a strange issue with ulimit:

  • when I manually run ./script.sh stop;./catalina.sh start I see that the number of open files is not OK (1024) as defined in system file limits.conf;
  • when a weekly job is executed which I have set up from cron, I have the correct value from limits.conf (16,384);
  • when I do /bin/su - user and then restart, I have the correct value
    also.

I need a solution to modify the script to somehow source my system value and have real login shell in the bash script and to have the correct number of open files when I need to restart the service manually.

Hard limit for current shell:

ulimit -Ha
open files                      (-n) 4096

Global:

cat /etc/security/limits.conf
oracle hard nofile 16384

Problem: when cron job is executed number of opened files is 16384 good!, when i run script from current shell ./script.sh stop; ./script.sh start i have 4096. Question is how to get 16384 when i run script manually ?

Ps editing of bashrc and bash_profile with ulimit -n <number> does not help.

Grammar and spelling
Source Link
terdon
  • 252.7k
  • 69
  • 481
  • 719

I have following scenario: i am connected to remote machine Linux RH6 directly via ssh (key imported on server),when i when I execute a shell script with arguments for restart ofrestarting the java service i, I have a strange issue with ulimit:

  • when i doI manually run ../script.sh stop;./catalina.sh start iI see that the number of open files is not OK (1024) as defined in system file    limits.conf;
  • when a weekly job is executed which iI have setupset up from cron icron, I have the correct value from limits.conf limits.conf (16,384);
  • when iI do /bin/su - user and then restart i, I have the correct value
    also.

I need a solution to modify the script to somehow source my system value and to have have real login shelshell in the bash script andand to have the correct number of open files when iI need to restart the service manually.

I have following scenario: i am connected to remote machine Linux RH6 directly via ssh (key imported on server),when i execute shell script with arguments for restart of java service i have strange issue with ulimit:

  • when i do manually ./script.sh stop;./catalina.sh start i see that number of open files is not OK (1024) as defined in system file  limits.conf
  • when weekly job is executed which i have setup from cron i have correct value from limits.conf (16,384)
  • when i do /bin/su - user and then restart i have correct value
    also.

I need a solution to modify script to somehow source my system value and to have real login shel in bash script and to have correct number of open files when i need to restart service manually.

I am connected to remote machine Linux RH6 directly via ssh (key imported on server), when I execute a shell script with arguments for restarting the java service, I have a strange issue with ulimit:

  • when I manually run ./script.sh stop;./catalina.sh start I see that the number of open files is not OK (1024) as defined in system file  limits.conf;
  • when a weekly job is executed which I have set up from cron, I have the correct value from limits.conf (16,384);
  • when I do /bin/su - user and then restart, I have the correct value
    also.

I need a solution to modify the script to somehow source my system value and have real login shell in the bash script and to have the correct number of open files when I need to restart the service manually.

Source Link
klerk
  • 2.9k
  • 2
  • 19
  • 16

how to run script with a clean login shell

I have following scenario: i am connected to remote machine Linux RH6 directly via ssh (key imported on server),when i execute shell script with arguments for restart of java service i have strange issue with ulimit:

  • when i do manually ./script.sh stop;./catalina.sh start i see that number of open files is not OK (1024) as defined in system file limits.conf
  • when weekly job is executed which i have setup from cron i have correct value from limits.conf (16,384)
  • when i do /bin/su - user and then restart i have correct value
    also.

I need a solution to modify script to somehow source my system value and to have real login shel in bash script and to have correct number of open files when i need to restart service manually.