batch処理

バッチ処理一覧
|No.|業務ID|業務名|JOBID|JOB名|説明|実行サーバー|処理サイクル|起動時間|備考|

Investigation when cron does not work well

If you are trying to run it regularly using cron, you will only get the execution log in “/var/log/cron.log”.
Therefore, the following is a reference as a method for letting the execution result of the command be outputted to the file.

1. Standard output
When outputting only standard output
/path/script.sh 1 > /path/exec.log

2. Error output
When only error output is issued
/path/script.sh 2 > /path/error.log

3. Standard output and error output part1
When outputting both outputs to one file
/path/script.sh > /path/both.log 2>&1

4. Standard output and error output No.2
When outputting each output to a separate file
/path/script.sh 1 > /path/exec.log 2> /path/error.log

How to specify envelop-from with PHP

To specify envelop-from in mail function, it is specified in $additional_parameters of the fourth argument.

$to = 'info@master.com';
$subject = 'test mail';
$msg = "hogehoge";
$header = "From: sender@sample.com";
$opt = 'sender@yahoo.co.jp';
$r = mail($to, $subject, $msg, $headers, $opt);
var_dump($r);

Writing Reply-to for mail sending

1.From, 2.Reply-to, 3.CC, 4.BCC, 5.Reply-to

mb_language("Japanese");
mb_internal_encoding("UTF-8");

$email = "xxx@example.com";
$subjet = "test";
$body = "this is test \n";
$to = 'yyy@example.com';
$header = "From: $email\nReplay-To: $email\n";

mb_send_mail($to; $subject, $body, $header);

Oracle Long

Columns defined as Long can store variable-length character data containing up to 2 GB of information. Long data is text data which is converted properly even if it moves between different systems.

Columns of the LONG data type are used in the data dictionary to store the text of the view definition. You can use the Long column of the SELECT list, the SET clause of the UPDATE statement, and the VALUES clause of the INSERT statement.

java.util.Properties props = new java.util.Properties();
props.put("user", "scott");
props.put("password", "tiger");
props.put("server", "myserver");

Driver myDriver = (Driver)
  Class.forName("weblogic.jdbc.oci.Driver").newInstance();

Connection conn = (weblogic.jdbc.oci.Connection)
	myDriver.connect("jdbc:weblogic:oracle", props);

	conn.waitOnResources(true);

yum clean all

Delete the cache with the yum clean command and check and execute the yum update. The file for caching rpm packages and data used for installing or updating by yum is saved in /var/cache/yum. Can confirm with the “du” command.

[vagrant@localhost tests]$ du -sh /var/cache/yum
179M    /var/cache/yum

/dev/null

/dev/null, also called null device, is one special file in Unix or Unix-type operating system, discards all the data written in it(write system call succeeds). It does not return data to any process (returns EOF)

[vagrant@localhost tests]$ sudo cat /dev/null
[vagrant@localhost tests]$

/etc/sysconfig/selinux

SELinux
SELinux(Security-Enhanced Linux) is a security extension module of the Linux kernel developed mainly by NSA(national security agency) in the united states. We will add the “secure OS” function to the Linux kernel. It is not the name of the distribution.

The biggest feature is that each process is designed to move with minimal authority considering the risk of root privilege.
The main functions are the following five. ref: security academy study meeting

1. MAC (Mandatory Access Control)
Only security administrator can set security

2. TE (Type Enforcement)
Access control for each process

3. Row Based Access Control(RBAC)
By assigning the administrative authority to the user, it is possible to avoid a mistake in operation with the conventional root

4. Domain transition
Allow only preset privilege escalation (deeply related to TE of 2)

5. Audit log
It is possible to logs of operations inside and outside the authority.

[vagrant@localhost tests]$ cat /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

disabled なので無効化されています。

getenforceでも見れるようです。

[vagrant@localhost tests]$ getenforce
Disabled

What is cookie?

A cookie is information stored in smartphone or PC from the website you are viewing. There are various contents such as the data and time of visiting the site, the number of visits, etc are recorded there.

So why does the website need to store information?

Cookie
Thanks to cookies to be able to see the website comfortably. For example, if you access a site once logged in by entering ID and password, such as Facebook or Twitter, after a while, you can go in without having to enter ID and password. This is thanks to the cookie where the login information is stored.

Or, while you are shopping at a shopping site, you log out with the item in the cart. After a while, if you access the same shopping site again, the items in the cart will not disappear and remain firmly. This is thanks to the cookie which stored the cart information.

In this way, cookie are extremely helpful in making the access and operation of the Web convenient, and enabling the provision of various services. Actually, if you do not enable cookies, inconvenience arises that websites are not displayed properly or you can not shop. Many of internet banking can not be used unless cookies are enabled.

Also, with cookies, websites can learn shopping history, user interests and topics, so they are also heavily used in corporate marketing analysis.