Skip to content
Advertisement

Tag: unix

EC2 ssh broken pipe terminates running process

I’am using a EC2 instance to run a large job that I estimate to take approx 24 hours to complete. I get the same issue described here ssh broken pipe ec2 I followed the suggestion/solutions in the above post and in my ssh session shell I launched my python program by the following command: Once I did this the connection

What should the “share” subdirectory contain?

When one has installed a library and look at what its repository contain, he may find something like that: repo/ bin/ lib/ share/ What the “share” repository should contain in general? Are there other types of subdirectories? Thanks! Answer The “share” word is used because what is under /usr/share is platform independent, and can be shared among several machines across

Measuring execution time with clock in sec in C not working

I’m trying to measure execution time in C using clock() under linux using the following: The output is: The documentation says to divide the clock time by CLOCKS_PER_SEC to get the execution time in sec, but this seems pretty incorrect for a 2sec sleep. What’s the problem? Answer Sleeping takes almost no execution time. The program just has to schedule

Cronjob script isn’t working as expected

I have a script that work perfectly fine when I manually run it by myself, but does not seem to run properly from crontab. The main error is that the (external) environment variables are not being set. I added SHELL=/bin/bash above the cronjob definition but still got the same errors. The script I have copied and pasted below. Cheers for

ls to list matches in specified directory

How do I list matched results in a specified directory? On my Ubuntu server if I list the contents of a directory it correctly lists it. My working directory is /var/crash. Let’s say I want to list all files that contain ‘tar’. In this example there should only be one match i.e. start.txt All’s good so far. However if I

replace text between two tabs – sed

I have the following input files: and I am trying to find the second string between the two tabs (e.g. text2, abc2) and replace it with another word. I have tried with but it only deletes the tab and does not replace the word. I appreciate any help! Answer I would suggest using awk here: Set the input and output

sleep 0 has special meaning?

I’m seeing a lot of usages of sleep 0 in my one of my client project. The code look something like this. Reading through some of the answer of SO like this it seems that sleep 0 has some significance. What I want to known now is that does scheduling for other thread to run (if they are waiting to

Advertisement