📜 ⬆️ ⬇️

Autorun programs connected to network drives in the required sequence

Since the system unit itself is only 256 GB for the system and software, most of the work files, libraries, archives, etc. I keep on a file server running XP which is connected via Gigabit Ethernet to a working computer. It is worth this device in the basement, it doesn’t bother with noise))) Folders with music and movies from this file dump for nubuck, tablets and smartphones are shared via Wi-Fi.

I wondered how to mount all these network drives in the MAC-OS? I read the Internet and wrote the script, making it into a standard program and falling asleep at startup.

image
')
So, what is used in it:
Since the computer is loaded so fast that the DHCP router does not have time to assign the MAC address to the MAC, giving an error that the team could not connect an external drive. Therefore, we had to put a ten-second delay before executing the commands for mounting network drives:

set pause to (10) delay pause 


The next step is to create volumes in the MAC and mount network disks.
Specification: MAC and file server hang in the WORKGROUP workgroup, and the server has the network name serverX32 (although you can use the IP address of the server):

 do shell script ("mkdir /Volumes/My_DOCs") <!--     My_DOCs   --> do shell script ("mount -t smbfs //login:password@serverx32/My_DOCs /Volumes/My_DOCs") <!--   SMB-     My_DOCs    ,    /,        /      (   ). --> do shell script ("mkdir /Volumes/Video") <!--        --> do shell script ("mount -t smbfs //login:password@serverx32/Video /Volumes/Video")  ..    … 




I use the Yandex.Disk client program, which I think is not necessary to explain for the beast. But not the task, his (Ya.D.) data is in my file dump too. If you stupidly insert Ya.D. into autoload, again, it loads faster than necessary, but does not see the network disk with its folder, and gives an error: “Yandex Disk is not detected, check the program settings.”
Nonsense, lengthen the script:

 set pause to (10) delay pause <!--  10 .    --> do shell script ("open /Applications/Yandex.Disk.app") <!--   ..     Applications/ --> 


Well, now smy tsimus. There is an awesome program: BitTorrent Sync . In three words, this is your own - unlimited personal cloud, running on PC, MAC, Linux, NAS, Android and iOS. With the ability to both full access to different folders of the cloud, and only for reading. Folders which and for whom to synchronize can also be managed. High privacy: all data lies only on your devices, all traffic is encrypted with a 128-bit algorithm. There are no restrictions on the size of a single file, speed, etc. This if to share something voluminous with friends and colleagues. All this stuff works under the P2P protocol. Here is more: http://ru.wikipedia.org/wiki/BitTorrent_Sync There is only one BUT - one of the main devices must be constantly online, for me this is not BUT - my 6th year file-dump lives like this.
Naturally, I include it in the script (since its root folder is also on the file server):

 shell script ("open /Applications/BitTorrent\\ Sync.app") <!--   BTS.     Applications/. :      '\\ ' Sync.app -   /   --> 


Here is the whole script:

 set pause to (10) delay pause do shell script ("mkdir /Volumes/My_DOCs") do shell script ("mount -t smbfs //login:password@serverx32/My_DOCs /Volumes/My_DOCs") do shell script ("mkdir /Volumes/Video") do shell script ("mount -t smbfs //login:password@serverx32/Video /Volumes/Video") do shell script ("mkdir /Volumes/Software") do shell script ("mount -t smbfs //login:password@serverx32/Software /Volumes/Software") do shell script ("mkdir /Volumes/MP3s") do shell script ("mount -t smbfs //login:password@serverx32/MP3s /Volumes/MP3s") do shell script ("mkdir /Volumes/Win_HDD") do shell script ("mount -t smbfs //login:password@serverx32/Win_HDD /Volumes/Win_HDD") set pause to (10) delay pause do shell script ("open /Applications/Yandex.Disk.app") do shell script ("open /Applications/BitTorrent\\ Sync.app») 


All this is done in the AppleScript Editor:

image

As everyone has prescribed for themselves, you can test the script by clicking on the start button (marked in red).
If everything works, save the script as a program: menu: File -> Export (in the save window, remove all the checkboxes) in the "file type" field, select the program.

PS I had a problem with network connectivity. TimeMashine: click here >>>
So, with such a view of the script for connecting network drives and the time-machine image, everything drives and beeps.
 do shell script ("hdiutil mount /Volumes/My_DOCs/NetTM.sparsebundle") 


The only thing that I did not understand after the sleep mode is the time machine is lost. Something to register in the script, so that after waking up, the TM image is picked up again?

Source: https://habr.com/ru/post/222439/


All Articles