Wednesday, June 27, 2018

Change coredump file location




# verify current setting
sysctl   kernel.core_pattern


You can change default core dump as below:
echo '/var/log/testprogram/core_%e.%p' | sudo tee /proc/sys/kernel/core_pattern

# verify the setting
sysctl   kernel.core_pattern


Now, all the programs if any major faults, will generate coredump in the above directory configured.

core_%e_%p
Here %e - program name , %p - pid of process

Check, man core for more details.


This article discussed about how to compress the core file generated:

https://docs.solace.com/Configuring-and-Managing/SW-Broker-Specific-Config/Docker-Tasks/Config-Core-Dump-Mgmt.htm

tee command vs redirect symbol


Usually I make use of > to redirect to a file.

We can also redirect using tee command.


Something like:

./test | tee test_output.log
So, here instead of > we are using tee.



What is advantage/ difference?

tee in addition to redirection copies the data to STDOUT.

Also, sometimes we want to see only specific lines with a pattern , we can use like:

./runprogram | tee program.log | grep Error
So, in this example, it logs all output , but displays only those lines with "Error".


Ref: man tee 




Friday, June 1, 2018

git add a new branch and push it to remote server




Add a new branch and push it to remote server:

git checkout -b new_branch

git push -u origin  new_branch