on boot scripts in mac osx? - linux

Are there any equivalent scripts run on boot on mac osx (/etc/rc.d etc.)?
such as we can found in linux:
https://stackoverflow.com/questions/3036/files-and-scripts-that-execute-on-boot

This is generally handled by launchd. Exactly how you do it (LaunchAgent vs LaunchDaemon) depends on whether you want it to be run as a system process or a user process. See Daemons and Services Programming Guide for details.

Related

Does Mac OS X use Linux?

The title says it all. At my job I've been asked to install a Ubuntu Linux system on a Virtualbox among other things so I can ssh into a development environment. This got me wondering about Operating Systems. I understand that Apple's is Mac OS X, but I just want to know if Mac OS X uses Linux or not. In August, I'm thinking of signing up for a Linux class on Edx.org so I can get better with the command line. I want to know if it will be a waste of time or not.
I've already looked up the history of Linux, Looked it up on Wikipedia, and googled it but surprisingly I didn't find an answer to this question. So once again, does Mac use Linux?
Mac OSX is built on top of BSD.
http://en.wikipedia.org/wiki/OS_X
Linux classes, in my opinion, are just fine and would enable you to be comfortable with the command line. The caveat is that there are differences such as the output or availability or options of commands. Instance is "ps". The system libraries, the folder structure are also different. Also note if you ever work on a *NIX server machine, invariably that would be linux. Note, there are no OSX servers anymore.
Mac OS X is based on BSD. BSD is similar to Linux but it is not Linux. However a big number of commands is identical.
Short answer: no
Mac OS X is based on Darwin, which is a descendant of Unix
It depends on the course, a shell scripting/bash course might be helpful since mostly the same commands are used, with some exceptions (some commands which are only specific to Mac OS X)
OSX uses Darwin, which is an OpenBSD variant. It is "UNIX-Like"
That means that while many aspects will be similar to linux, not EVERYTHING is the same.
For instance, the file system resembles linux, but has some differences such as the frameworks directories, /Applications, /Library, etc...
I started with Linux quite some time ago, at a point it gives you a pretty insight into how other systems work in general. But when you want to learn it just for an ssh from the terminal, you are effectively wasting your time. There is a command line on every operating system out there, unless it was prohibited from use by the administrator from the admin account. They need to kill the process completely, just to keep you away from it. On another hand, if you learn Linux, you would be able to adapt to the server environment because in the server rooms everything runs from the terminal. You can rarely find any enterprise architecture running on a GUI environment, and it gives you plenty of space for creativity because most of the applicants have never seen a server terminal equipment to begin with. Each terminal has their own language, so if you are learning OS X terminal it has a different set of terms than Windows terminal, Ubuntu terminal and other server equipment. In each one of them "learning" process is set from do-fail-repeat-fail-succeed-destroy-repeat. There is no single efficient way of doing that all.

How do I create a Linux bootup USB stick that only runs my one program automatically?

I want to create a USB stick that has the smallest version of Linux possible that only runs my one program automatically when booted from.
Do I have to write my program in a special way to do this?
Do I have to build the Linux kernel myself in order to be able to distribute the software without having to pay anyone else?
Thanks!
Universal USB Installer does it for you.
http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/
You can install archlinux on it which is very light. And then you can write a script to execute your program on start up.
It will all be free, but for commercial use, read the GNU license that comes with the linux distributions.
May be you are looking for this
http://www.damnsmalllinux.org/wiki/installing_to_a_usb_flash_drive.html

Launch process from CGI in Linux

I need to launch server executables from terminal. They are running through wine (because those executables are for Windows) in the background. If I launch them normally, from Terminal, those work without any problem.
Now I'm trying to make CGI (bash) script and launch servers from website, but script doesn't launch processes. I thought that it has something to do with wine, but no, script doesn't launch any processes at all.
I'm building that system on Ubuntu 12.04.1 LTS, after that scripts would go onto Debian server.
So, the question is: is it even possible to run background process from CGI scripts? If yes, would you please explain how?
A CGI program is like any other program, except that it is supposed to run quickly and to follow the CGI protcol (in particular, regarding to stdout output).
As with any other Linux program, you can (subject to limitations and permissions on your system) run processes, using syscalls like e.g. fork(2), execve(2) and many others.
I suggest to read a good Unix programming book like Advanced Unix Programming abd Advanced Linux Programming. We can't teach all that here in a few minutes.
You could also run processes using the library system(3) and popen(3) functions (of course these functions are implemented using syscalls, inside GNU libc)
Don't forget the stateless property of CGIs; you may consider using FastCGI or SCGI instead.
(A program started thru wine from a CGI might fail, e.g. because it has no X11
server to talk to; For C# programs, consider Mono on Linux).
Another possibility could be to run Windows in some VM, and have your CGI interact with such virtualized Windows programs. Not knowing Windows, I have no idea about the issues of such an approach.

How to verify cross platform installation steps

I have to check installation steps of my application on different production machines. I want to check how can I install my application on HP UX. I have only linux/windows machines but dont have real physical HP unix machine. Is there any way i can check installation steps of HP unix. I am thinking of any virtual environment or any flavour that run on linux or windows which gives accessiblity and functionality of HP unix.
I am looking something to cross check platfrom installation steps.
The short answer is no. HP-UX is as different from Linux as Linux is from Windows (almost). There would be many differences in libraries, patches, installed utilities, build tools, etc.
A few examples:
HP-UX does not come pre-installed with the bash shell
HP-UX uses a proprietary software packager and installer called swinstall (analogous to RPM but completely different)
Partition layout is different
Many common utilities behave differently. "echo" is one of many examples. This will affect things if your build process uses shell utilities
Even if you can test the install, don't you need to test the product's operation on HP-UX?
Not saying it's impossible. If your application uses basic, nonspecific utilities for install, it might work. There is no way to know without a running installation. Unfortunately you need Itanium hardware and the O/S.
My recommendation would be to get your application working on Solaris and any other Unixes first. The more platforms you test on, the more portable your code will become on all of them. Then, put out some feelers and find someone with a system you can borrow time on.
Worst case, find an Itanium server like an rx2620 on eBay, should not cost too much. Even better if the seller forgets to wipe the O/S :). You'll need a terminal and possibly null modem. 11.31 (11iv3) is the latest version of the O/S.

Is it possible to remotely debug linux code from a non-linux system?

I know it is possible to remotely debug code using gdb's server mode and I know it is possible to debug code that has been cross-compiled for another architecture, but is it possible to go a step further and remotely debug Linux applications from OS X using gdbserver?
Certainly, but you need a cross-compiled GDB, compiled for OSX-host and Linux-target. This is not at all uncommon; there should be plenty of GDB documentation to cover this.
It is possible from Windows with Cygwin.
I don't know about OS X.

Resources