vendredi 30 janvier 2015

CentOS rescue mode


After a power outage somehow my server is not finding the boot partition anymore. As far as I read about recovering a CentOS 6.4 I just need to pick "Rescue installed system" option from the boot menu.


But where is the "Rescue installed system" on the boot menu?


I had boot from the same liveCD which the original installation was done. But there's no option like that. I even tried to type "linux rescue" on boot command line, no success so far. It did not find the kernel image.


Seens to be so simple task, but I given up... Thanks in advance!



What to do for resolveip output the domain name


What I must have do to I can use resolveip (on any machine connected on internet) and get the output:



Host name of xxx.xxx.xxx.xxx is mydomaing.com


and not



resolveip: Unable to find hostname for xxx.xxx.xxx.xxx


List the files of another format while finding a certain name pattern


I had wanted to edit the txt files of videoA and videoB only if the movs files names contains the namespace -test


For eg.



videoDir
|-videoA
|- videoA_v001_test.mov
|- videoA_v001_info.txt
|-videoB
|- videoB_v001_test.mov
|- videoB_v001_info.txt
|-videoC
|- videoC_v002.mov
|- videoC_v002_info.txt


Above, I want to edit videoDir/videoA/videoA_v001_info.txt and videoDir/videoB/videoB_v001_info.txt but not videoC_v002_info.txt since the corresponding .mov file name doesn't contain test.


I come up with the command - find -name "*.mov" | grep -rn "test" | find -name "*.txt", find -name "*.mov" | grep -rn "test" does indeed lists out the 2 files that fulfills the condition (videoA and videoB). I added infind -name "*.txt"` as I had thought it will filter it down to the txt files within the output results, however I was wrong as it is still listing all the txt files



Crunchbang: Can't use simple-scan without administrator rights


I'm running the latest version of Crunchbang 64-bit on a Dell E5510 notebook.

Installing my printer and scanner worked fine - I just used an existing Ubuntu tutorial. However, scanning without starting Simple-Scan as sudo produces an error message. My main account is listed as part of the group scanner, according to the output of less /etc/group. To my limited knowledge, this should suffice, shouldn't it? What more steps are necessary in order to run simple-scan without sudo?

Thanks in advance.



Can I do reverse traceroute?


Is it possible to do reverse traceroute ? This is very important for me to know, Why the websites are loading slow for my clients in certain area ?



Writing a program for editing .txt data - Python or Unix?


I only have little experience in programming, and I'm currently working on improving my skills. Basically, I need to write a program, that can do some specific processes to some data in a .txt file.


To start from scratch, I have a .txt file with data looking like this:



>tex_1 abcdefghijklmnopqrstu
>tex_2 abcdefghijklmnopqrstuv
>tex_3 abcdefghijklmnopqrstuv
>tex_4 abcdefghijklmnopqrst
// x
>tex_1 abcdefghijklmnopqrstu
>tex_2 abcdefghijklmnopqrstuv
>tex_3 abcdefghijklmnopqrst
>tex_4 abcdefghijklmnopqrstuv
// x x
>tex_1 abcdefghijklmnopqrstuv
>tex_2 abcdefghijklmnopqrstuv
// x x


I need to do some weird stuff to this data, in order to end up with a data set, that can be analyzed in the software I use. Each "//..."-line refers to the group of data above, until the next "//..."-line


Here's a line-up of what I want to do:


Shift the "//..."-line, so the group of data it refers to is below this line, and not above it:



// x
>tex_1 abcdefghijklmnopqrstu
>tex_2 abcdefghijklmnopqrstuv
>tex_3 abcdefghijklmnopqrstuv
>tex_4 abcdefghijklmnopqrst
// x x
>tex_1 abcdefghijklmnopqrstu
>tex_2 abcdefghijklmnopqrstuv
>tex_3 abcdefghijklmnopqrst
>tex_4 abcdefghijklmnopqrstuv
// x x
>tex_1 abcdefghijklmnopqrstuv
>tex_2 abcdefghijklmnopqrstuv


Add a unique name to each group after //, without shifting remaining text on the line:



//Name 1 x
>tex_1 abcdefghijklmnopqrstu
>tex_2 abcdefghijklmnopqrstuv
>tex_3 abcdefghijklmnopqrstuv
>tex_4 abcdefghijklmnopqrst
//Name 2 x x
>tex_1 abcdefghijklmnopqrstu
>tex_2 abcdefghijklmnopqrstuv
>tex_3 abcdefghijklmnopqrst
>tex_4 abcdefghijklmnopqrstuv
//Name 3 x x
>tex_1 abcdefghijklmnopqrstuv
>tex_2 abcdefghijklmnopqrstuv


Output this to a new file, without changing the original. Then grab each name-line + line below, and output this to a File2:



//Name 1 x
>tex_1 abcdefghijklmnopqrstu
//Name 2 x x
>tex_1 abcdefghijklmnopqrstu
//Name 3 x x
>tex_1 abcdefghijklmnopqrstuv


Change the structure, so the naming is like the following, and output this to File3:



>Name 1 abcdefghijklmnopqrstu
>Name 2 abcdefghijklmnopqrstu
>Name 3 abcdefghijklmnopqrstuv


The above data is in a structure, I can actually analyse.


Now I know this is guite the task (especially for a complete programming-noob), and I am not asking you "how do I program this. I would just like to know, where you guys would start with such a project, and what language do you think fits the project best?


I managed to do a few things in unix, by getting help on this site. E.g. Giving unique names to each "//..." line, by the following unix code:



awk -F '' '/\/\//{n++ ; t=" Name "n ; sub("// {0,"length(t)-1"}","//"t)}{print}' File1.txt


Could you give me some hints for where to start? Is the problem suitable as a Python project? The original .txt data file contains a lot of data, so it is not possible to do the processing by hand. Also this project is meant as a way to get further into programming.


Thank you!



What port uses my backportpackage or bzr?


I am working in a company what uses Ubuntu Precise on the desktops behind a proxy. The Proxy is available in /etc/environment and set as: http_proxy, https_proxy, ftp_proxy, no proxy and their uppercase versions.


So actually i have a problem with using some applications inside the Bash. If i'm using backportpackage (like backportpackage -s trusty -d precise fop) or bzr branch then just comes up a timeout.


Now i'm guessing that the programs trying to use an unsupported (from Proxies Firewall) Port. But if i can find out what port it uses, i can ask the Admins for opening the port.


May anyone can help with this?