Quick Tip: Change A Scheduled Job’s Time Zone Using SQL

SQL Ninja

If you work with multiple time zones, especially if one uses Daylight Saving Time and the other does not, it can be useful to have scheduled jobs setup using the appropriate time zone.

This can be done by creating separate versions of the P91300 – Scheduled Jobs application.

After running with multiple versions of the P91300, you may find it necessary to move or copy a scheduled job from one time zone to the other. Unfortunately, there is no way to do this using the application.

So, not to be denied, I figured out a little SQL that can be used:

UPDATE SY900.F91300 
SET SJTIMEZONES=11 --(UTC+08:00) in UDC H91/TZ
WHERE SJSCHJBNM='TEST JOB'

It’s quick. It’s dirty. But… Hey! That’s one of the beautiful things about SQL.

 

Basics of the Linux Top Command

Recently, I had a tip submitted that referred to using the Linux top command to “check overall CPU utilization and individual CPU utilization”. Thanks, Sworna Dunant. It’s a good tip. However, top can be used for so much more that I decided to expand on it a little…

Before we get started, please note that the top command has it’s own versions and has slightly different options with each version. To check your top command version use the following:

$ top -v
top: procps version 3.3.9

Also, the options explained below are those that I have found useful and are by no means a comprehensive list of what can be done using top. More detail can be found in the man pages or here.

Display Running Processes

The screen below displays a table of the currently running processes with some very useful information:

  • PID – Process ID
  • User – The UserID running the process
  • %CPU – CPU used by the process
  • %MEM – Memory used by the process
  • Command – The command the process is running

If you look in the header there is even more info:

  • Uptime
  • # of Users on the system
  • Load Average for the last 5 min, 10 min & 15 min
  • More explained in detail here
$ top
top - 06:42:15 up 228 days, 11:32,  1 user,  load average: 0.35, 0.52, 0.60
Tasks: 195 total,   1 running, 194 sleeping,   0 stopped,   0 zombie
Cpu(s): 16.8%us,  2.3%sy,  0.0%ni, 78.5%id,  0.0%wa,  0.7%hi,  1.7%si,  0.0%st
Mem:   8175332k total,  5788888k used,  2386444k free,   510972k buffers
Swap: 16779852k total,       96k used, 16779756k free,  2179896k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
11159 user      15   0  217m  81m  19m S 19.0  1.0  18:38.26 runbatch
28053 user      15   0  168m  41m  18m S 12.6  0.5   1:28.43 runbatch
16222 user      15   0  127m  27m  15m S  2.0  0.3   3:34.47 jdenet_k
16262 user      15   0 1398m  98m  24m S  1.7  1.2   4:30.66 jdenet_k
16339 user      15   0 60232 3848 3144 S  1.7  0.0   2:40.67 jdenet_n
16242 user      15   0  803m 146m  30m S  1.3  1.8   8:03.14 jdenet_k

Sort by Memory, CPU Usage, Process ID or Runtime

Use the following key strokes to sort the Top data:

  • Shift+M – sort by descending Memory usage
  • Shift+P – sort by descending CPU usage
  • Shift+N – sort by descending Process ID
  • Shift+T – sort by descending Runtime

Change The Refresh Interval

By default the top command refreshes the data every 3 seconds. That delay can be changed by pressing the [d] key. Top will ask you to enter your desired value, which can be less than 1.

top - 00:25:49 up 229 days,  5:15,  1 user,  load average: 1.09, 1.27, 1.16
Tasks: 194 total,   2 running, 192 sleeping,   0 stopped,   0 zombie
Cpu(s): 38.4%us,  1.3%sy,  0.0%ni, 56.7%id,  0.0%wa,  0.8%hi,  2.8%si,  0.0%st
Mem:   8175332k total,  6829240k used,  1346092k free,   562332k buffers
Swap: 16779852k total,       96k used, 16779756k free,  2809648k cached
Change delay from 3.0 to: .5
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
16243 jde900    15   0  654m 311m  36m S  0.0  3.9  15:34.52 jdenet_k
16242 jde900    15   0  804m 146m  30m S  0.3  1.8  15:44.62 jdenet_k

Display The Full Command Path and Arguments

Press the [c] key to display the full command path and arguments of the processes.

top - 00:31:50 up 229 days,  5:21,  1 user,  load average: 1.39, 1.37, 1.22
Tasks: 196 total,   3 running, 193 sleeping,   0 stopped,   0 zombie
Cpu(s): 49.3%us,  4.5%sy,  0.0%ni, 41.3%id,  0.2%wa,  0.8%hi,  3.9%si,  0.0%st
Mem:   8175332k total,  6883860k used,  1291472k free,   562528k buffers
Swap: 16779852k total,       96k used, 16779756k free,  2812428k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
21132 jde900    15   0  182m  60m  18m R 64.2  0.8  21:40.48 runbatch USER PASSWORD
19876 jde900    15   0  277m  45m  19m S 16.3  0.6   0:22.50 jdenet_k 6015
25324 jde900    15   0  170m  44m  19m S 11.6  0.6   0:20.20 runbatch USER PASSWORD
25330 jde900    15   0  166m  39m  18m R  8.3  0.5   0:15.26 runbatch USER PASSWORD
17067 jde900    15   0 60320 3948 3208 S  6.3  0.0   4:38.34 jdenet_n 6015
11594 jde900    15   0  185m  45m  19m S  5.3  0.6   1:57.17 runbatch USER PASSWORD
16242 jde900    15   0  804m 146m  30m S  0.3  1.8  15:45.21 jdenet_k 6015

Display CPU Core Information Separately

Press the [1] key to display the individual CPU core information in the header.

Tasks: 195 total,   1 running, 194 sleeping,   0 stopped,   0 zombie
Cpu0  :  3.0%us,  0.3%sy,  0.0%ni, 96.6%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu1  : 37.0%us,  1.3%sy,  0.0%ni, 56.9%id,  0.0%wa,  1.3%hi,  3.4%si,  0.0%st
Mem:   8175332k total,  6856660k used,  1318672k free,   562768k buffers
Swap: 16779852k total,       96k used, 16779756k free,  2815036k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
21132 jde900    15   0  182m  60m  18m S 30.9  0.8  25:14.79 runbatch USER PASSWORD
25330 jde900    15   0  167m  40m  18m S 13.0  0.5   0:48.80 runbatch USER PASSWORD
16262 jde900    15   0 1398m  94m  24m S  0.3  1.2   8:57.37 jdenet_k 6015

Conclusion

There are many options to consider when using the top command to quickly get system performance information from your Linux servers. Those above are just the ones that I have found to be useful in supporting Oracle JD Edwards EnterpriseOne. A more in depth article can be found here.

If you have any tips for the top command or any others that you use, please let me know in the comments.

 

Quick Tip: How To Find OS Version On IBM i

To find the OS version of the IBM i (iSeries, AS/400), use the commands below:

DSPSFWRSC

F11

The above commands will result in a screen similar to the one below:

IBM i Version

How To Kill Zombies The Easy Way

How To Kill A Zombie

Zombie processes have been the scourge of the JDE EnterpriseOne landscape for CNC Admins for many years. Usually, they are difficult to troubleshoot because many times there are no logs to assist you and if you do happen to get a log file, more often than not, it just ends abruptly with no hints as to what caused it.

ServerManager-ZombiesSo, what are these “zombies”?

They are server processes that have ended but the system thinks they are still out there and available to do work. It doesn’t take long to figure out that it’s a problem if a Call Object Kernel has died but the system is still sending it work to do.

I’m sure there is an explanation that is a lot more technical and detailed, but for how far I need to dive into these things the above is good enough for me.

How do you get rid of Zombies?

Remove Zombies Using Server Manager

Zombie-ProcessesThe traditional way to rid your system of the dreaded un-dead is to use Server Manager. Use the [Process Detail] view on the EnterpriseServer that has the issue and sort by [Process Status]. You will need to click the column title twice because the processes you are looking for have a status of “STOPPED”.

Then, we check the box beside the little bugger and click [Remove Zombie].

Remove Zombies The Easy Way

Nimish Prabhu has used his .Net skills to devise a way to kill zombie processes using the command line.

Why is that so cool?

Because it can be put into a script and scheduled!

clearzombies JDEDEPSVR.company.com 8999 <USERID> <ENCRYPTED PASSWORD> JDEUBESVR.company.com Ent_Prod /u01/apps/jdedwards/e900/jde_home/agent

Yep, that’s right! Instead of trudging around in Server Manager when you are alerted of a zombie process (Yes, you can be alerted of zombies if you set it up the Monitor in Server Manager), you can just run a script every few hours or so and not have to worry that your system is being overrun by the un-dead.

Nimish’s little application supports Tools Release 8.984.7 and higher. He was very responsive when I had a question and worked with me to extend it’s compatibility.

Thanks Nimish for helping CNC Admins rid the world (or is it OneWorld) of Zombies!

 

5 Ways to Empty a File on Linux

Like most operations on any Operating System, there are several ways to do basic file manipulation on Linux. Below are 5 different ways to empty a file.

Simple Redirection

Redirection is usually used to output command results to a file.  However, if we redirect “nothing” to a file, we can overwrite it with a blank file. Redirection can be done using a “&gt;” greater-than symbol or a “|” pipe symbol.

# > file.txt
or
# :> file.txt

REDIRECT THE echo command

Use the echo command to redirect null values to a file.

# echo -n > file.txt
  • n do not output the trailing newline.

UsE THE truncate command

Use the truncate command to shrink or expand the size of a file to the size specified by the s option value. Use zero to make the file empty.

# truncate -s 0 file.txt
or
# truncate file.txt --size 0

REDIRECT THE /dev/null device

The null device is usually used for disposing of unwanted output streams of a process or as a empty file for input streams or a redirection operation.

# cat /dev/null > file.txt
or
# cp /dev/null file.txt
cp: overwrite 'file.txt'? y

SCRIPT THE Vim Editor

Vim is a text editor built to make creating and changing any kind of text very efficient. It is included as “vi” in most Linux/Unix systems.

# ex -sc ':%d|x' file.txt
or
# ex -sc ':1,$d|x' file.txt
  • ex : Enter into Ex mode
  • s : Silent; do not display prompts
  • c : Run the given ex command upon startup
  • : : Invoke an ex command
  • % : Choose all the lines
  • d : Delete selected lines
  • x : save and close
  • 2g.txt : input filename