Guest User

Untitled

a guest
Apr 12th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. Here is the deal. I have two scripts. One is a bash wrapper script that establishes a tunnel, and kicks off the Perl scripts. The second is a Perl script that is in /home/oracle/code/perl/. I will post code below.
  2.  
  3. I understand cron uses different permissions and environmental variables. I've tried declaring my Oracle environmental variables in the Bash script, or in the Perl script, or in both...
  4.  
  5. Regardless of what I do... the script won't kick off as a cron job. I don't know why. I've got it scheduled properly, because I can see the script act like it's running in /var/log/syslog... I've got an "alarm clock" that plays an MP3 for me to wake up by in the morning...
  6.  
  7. I just don't know why this script won't run. It's probably something easy I'm missing. I can run the scripts locally... they both have permissions for the right user, both are executable.
  8.  
  9. I will pay for an Amazon Wishlist item for someone that can get this solved for me. Up to $40. /pm me if you're interested, and I'll give you my email address, it's not published here.
  10.  
  11. Bash script:
  12.  
  13. #!/bin/bash
  14. # DSTs - script to run Daily System Tests
  15.  
  16.  
  17. echo on
  18.  
  19. # Start the first tunnel - run the first script
  20. ssh -vfNL 1521:foo_ip:2046 admin@barip
  21. export SSHPROC="$(ps axu | grep -e "ssh -vfNL" | grep -v "grep" | awk '{ print $"2" }')"
  22.  
  23. /usr/bin/perl /home/oracle/code/perl/dst_lala.pl &&
  24.  
  25. # Start the remaining scripts
  26. perl /home/oracle/code/perl/dst.pl &&
  27.  
  28. # killall -9 ssh
  29.  
  30. kill -0 "${SSHPROC}" 2> /dev/null && kill "${SSHPROC}"
  31.  
  32. echo off
  33.  
  34.  
  35.  
  36. Perl script:
  37. #!/usr/bin/perl
  38.  
  39. use Net::Ping;
  40.  
  41. @cd_to = ( "foo" );
  42.  
  43.  
  44. @ssh_path = ( "bar" );
  45.  
  46.  
  47. $sql_user = "lala";
  48. $sql_password = "land";
  49.  
  50.  
  51. foreach ( @ssh_path ) {
  52. $sitedir = $cd_to[$i];
  53. chdir "/home/oracle/sql_scripts/".$sitedir;
  54. system "sqlplus $sql_user/$sql_password\@'$_' @/home/oracle/sql_scripts/blah.sql";
  55. $element = $ssh_path[$i];
  56. $i++;
  57. }
Add Comment
Please, Sign In to add comment