How to find a script that modifies a file on startup - file

I am currently on a machine where i have to change an existing script.
Nobody knows what path are.
I only know that modifies a file at startup , and it expects to have internet to do.
I try to find it with lsof but it looks like it is not enough "fast". It shows me nothing. I try to do with wireshark if he would send something, but nothing too.
I try to search with grep but nothing conclusive.
The machine is under OpenSuse x64 and i can be root.
Anyone have a solution for me? Thank you in advance.

Rc files or profile files are used to run commands on startup(depending on login or non login shells). These could be Generally in /etc - global and in home directory for user specific setting.
Have your considered checking contents of /etc/bashrc or /etc/bash.bashrc or profile? What did you grep for?

Related

Is it possible to use a GUI based text editor (e.g. Eclipse) from the terminal?

I'd like to use terminal for all of my normal git and compiling and running processes (my school has a server that is linked to my repo on bitbucket), but I really don't like terminal-based text editing software such as Emacs and Vim. Is it possible to open and edit files from the terminal using a GUI based text editor? The reason I'm asking is because the terminal is the only way I can access the server files. Thanks in advance!
Aw, but vim is the best! :) Well, you can use nano, which is friendlier. Or, if you insist: if you are using SSH to connect to the server (and the server has an X server running !) then you can look into the ssh -X option to view X windows on your remote machine.
Oh and you could look into scp command as well (behaves almost just like regular cp, but the destination is on another host). That way you could edit on your machine, then copy it via SSH (although you'd want to be careful when copying files directly to the server filesystem)
Edit: Also, if you really don't like using the terminal (why though? (-: ), some file managers allow you to get the same functionality of the previous commands purely via GUI (for example).
You've left out some important information that someone would need to know to answer your questions. The other posters have made some assumptions.
You've mentioned this "terminal", but it's not clear exactly what that is, or how you're getting to it. What kind of computer do you have in front of you? What shell is running in that terminal? Is the shell running on your local computer, or have you remotely connected to a server and running that shell on the remote computer?
Based on what you said, I have a feeling you're making a remote connection to a server, perhaps using ssh. You likely have either a Windows or Mac PC in front of you. In those circumstances, running a GUI editor like Eclipse is possible, but likely not practical. You would have to have Eclipse installed on that remote computer, and you would be displaying the Eclipse window on your local computer using the X11 protocol. That takes a lot of bandwidth.
If my assumptions are correct, my recommendations depend on how long you expect you're going to want to stay familiar with this environment. If you intend to do this sort of work forever, then you should learn vi and Emacs to the best of your ability. As someone who's been using Emacs likely longer than you've been alive, I'd recommend you learn it, but vi is also a critical skill.
UNIXY systems provide open or gopen, depending on your OS, that should get the job done. From the man page:
By default, gopen will open filename with the application currently assigned to the file's extension. But by specifing the -a flag on the command line you can tell gopen to open the file with another application.
This means that you can use it to open files in your preferred editor
with a line like
gopen -a Eclipse file

File permission with Class File

i would like to ask , because in some scenario, some class.php are not being run. even if it is in full permission,
sample.
i have a linux pc. and every time i create class.php file. i modified it like :
sudo chmod -Rf 777 file.class.php
then after that. it works on my localhost.
BUT when i transfer the file using FileZilla to other server its not running.
even if it has Full Permission 777 in File Zilla.
Can anyone explain whats the reason behind this ?
coz i cant explain to my superior why its that running but in my localhost/Pc its running.
and they have the same File and codes inside it.
please help me..
thank you very much.
It's possible that your server automatically modifies the permissions of the file when you upload it even when you have it set to something in filezilla. I know that Windows with NTFS can sometimes strip permissions off of a file depending on how you copy/move the file. This might be what is happening with your linux computer.

File permissions question

I just switched my site's server from Windows to Linux, and am finally able to control file permissions from my ftp. So, seeing that all permissions were 705 by default (and not wanting just anyone to have permission to execute), I went and changed everything to 744.
Now, gif and jpg links don't work, pdf download links don't work, php links don't load, and mov files don't play. Setting things back doesn't seem to help. Even setting to 777 gets me nowhere.
Any ideas on what might be going wrong? I've been googling file permissions all day (solved that problem with the Linux switch, which now bred a new problem), and I don't think anything has escaped my attention.
Thanks!
Try to set owner permissions. Apache runs usually under www-user or some other sandbox user, so you wanna try to use chgrp, chown an chmod.
Solved. I was under the mistaken impression that group and public did not need x. On the contrary, x is used to read the files. I set the relevant folders to 755, and everything worked. Why it didn't work when I had all set to 777, I don't know. Lack of sleep, probably.
Thanks!

How do I find the database file on an Android virtual device?

My plan is to prepopulate a database on a virtual device and then include database in the distribution of my app.
However, I can't find the database file.
Is it on my hard disk some where?
How do I get it?
I tried connecting using adb, I did an "ls" and then got really scared by this obscure list of directories:
sqlite_stmt_journals
cache
sdcard
etc
system
sys
sbin
proc
init.rc
init.goldfish.rc
init
default.prop
data
root
dev
Even when I cd over to /data/data/your.package.here/databases I still do not have access to the actual database file. I can't use sqlite3 or do a pull on it. Is there a way to change permissions?
This works fine on my emulator, but fails on the actual device
adb pull /data/data//databases/mydb.db .
It should be in /data/data/your.package.here/databases, where your.package.here represents the package associated with your application, as defined in your AndroidManifest.xml file.
If you want to navigate to your database (which is located /data/data/your.package.here/databases), make sure you are a root user while navigating shell. To do so, type "su" once you enter the command prompt. When you are a root user, you can navigate wherever you want.
The blog post below gives a good solution of how to find and access your database. The post talks about using busybox, which provides useful utilities at the command line, to find your database and gives a few useful examples on how to use sqlite3 to access the DB and tables.
http://davanum.wordpress.com/2007/12/11/android-how-to-poke-around-the-sqlite3-databases/

How to allow a user to edit data in a separate app from the terminal?

I am writing a terminal-based application, but I want the user to be able to edit certain text data in a separate editor. For example, if the user chooses to edit the list of current usernames, the list should open as a text file in the user's favorite editor (vim, gedit, etc.). This will probably be an environment variable such as $MYAPPEDITOR. This is similar to the way commit messages work in svn.
Is the best way to do this to create a temporary file in /tmp, and read it in when the editor process is terminated? Or is there a better way to approach this problem?
There's already a $EDITOR variable, which is extremely standard and I have seen it working on a wide variety of unixes. Also, vi is always an option on any flavor of unix.
Debian has a sensible-editor command that invokes $EDITOR if it can, or falls back to some standard ones otherwise. Freedesktop.org has an xdg-open command that will detect which desktop environment is running and open the file with the associated application. As far as I know, sensible-editor doesn't exist on other distributions, and of course xdg-open will fail in a text-only environment, but it couldn't hurt to try as many options as possible, if you think it's important that a desktop user can see their happy shiny gedit or kate instead of scary old vi or nano. ;)
The way crontab and sudoedit work is also by making a file in /tmp. git puts it under .git, and svn actually puts it in the current directory (not /tmp).
The way svn and mercurial do it is by making a file in /tmp.
BTW, you don't need a MYAPPEDITOR, on nix there's EDITOR already present.
Since you mention svn in your post, why not just follow the same methodology? svn opens a file with a particular name with whatever $EDITOR (or $SVN_EDITOR) contains - this might actually require some work on your part; determining the parameters to each supported editor. In either case, you have the name of the file that was saved (or the error code of the application if something failed) and you can just use that.

Resources